constraints, semantic kludge?... 
Author Message
 constraints, semantic kludge?...

I had implemented constraints, and then something seems to keep starring at
they don't fit really very well with my language semantics (essentially the
same as scheme...).

ok, I have these objects, that I put in variables, that come up as values
when I reference the variable. this does not seem to fit, ie, with the "you
put object in variable, you get same one back out" feel of things...

I had thought about it and the problem is that the only ways I could think
of make this not a kludge would involve serious changes to the language
semantics, basically:
I have objects that are transparently the value they represent, and can be
passed around and at some point become the value they represent (ie: when
printed). ok, this is similar to lazy evaluation except in the case of use
of a constraint in a computation, the result is unclear with respect to
changing the constraint (which would imply that all values using the
variable are also recomputed).

I will write fragments with the hypothetical semantics:
(define x 3)
(define y 4)
(define z (sqrt (+ (* x x) (* y y))))

z => 5, ok, as expected
(set! x 6)
(set! y 8)
z => 10, a little weirdness shows up

back to the 3/4/5 case.

(define w (vector x y z))
w => #(3 4 5)

(set! x 6)
(set! y 8)
w => #(6 8 10)


though it sort of makes sense, it seems really weird, and somewhat unlike
scheme (and more like a kind of algebra program...).

ok, my current semantics are a bit more modest, more they are like:

(define x (constraint 3)) ;this seems kludgy, the "what goes in does not
come out" issue.
(define y (constraint 4))
(define z (constraint (sqrt (+ (* x x) (* y y)))))

x => 3
y => 4
z => 5

(define w (vector x y z))
w => #(3 4 5)

(assign! x 6)
(assign! y 8)
z => 10

w => #(3 4 5), since w was a normal value and not a constraint

I used assign! because I wanted set! to wipe out constraints, was usure
whether this makes sense though (having assign! distinct from set! seems a
little messy, but otherwise set! would be unable to get rid of the
constraints from bindings...).

ok, objects can also have constraints.
I was unsure whether or not they should be allowed in cons cells/vectors,
ie: if they were you could have recomputing lists and vectors (without
defining them as constraints).

I am sorry, I am not a cs dude so I don't really know what is best...

cr88192 at hotmail dot com
http://www.*-*-*.com/ (old)

Mon, 16 Jan 2006 03:03:42 GMT  
 [ 1 post ] 

 Relevant Pages 

1. null ranges and index constraints (was constraint error question)

2. CFP - A special issue of the Constraints journal on Constraint Agents

3. tcltest::test -constraints <constraint with ::>

4. Kludging INTERPRET

5. Avoiding Kludges

6. Help needed for gratuitous kludge

7. The repr kludge

8. Array variable name decomposition - kludge leads to bug

9. Syntax / Semantic Error

10. RFC: Smalltalk Semantic Specifications (S3)

11. Semantic Drawing Editor for IBM Smalltalk?

12. Semantic Networks in Smalltalk?


Powered by phpBB® Forum Software