Quote:
>I'm struggling to understand setter syntax.
Recently, I've been using Kenneth{*filter*}ey's YASOS object system
for Scheme. It includes something with a syntax much like the
original Dylan setter syntax. This gave me an idea about what in
the world lead the Dylan designers to start with that setter
syntax--variables that look like lists. I haven't really used
this aspect of Yasos or worked through the code, but I think that
the idea is that in Yasos the getter is a function which either
returns the contents of the object slot, or else returns a setter
function. So
(<getter-name> <object>)
will return the value of the slot associated with that getter, while
(setter <getter-name>)
will return a setter function which can be used to set the value
of the same slot. Thus in
((setter <getter-name>) <object> <new-value>)
"(setter <getter-name>)" will evaluate to the setter function,
which is then applied to the object and the new value, thereby
setting the slot to the new value.
*This* makes sense to me. It's one of those nifty Scheme tricks
that I find fascinating.
But making
(setter <getter-name>)
into a variable is really confusing.
Anyway, my theory is that originally the Dylan designers had in
mind something like the way setters work in Yasos (this is
probably a traditional Scheme device that Yasos just made use
of). But then the designers decided that setters should be
variables instead of function calls (I suppose it's more
efficient at run time), and they just made the setter function
call syntax into a variable name. And by the time the manual was
written, there was no reference to the original idea behind the
setter syntax, so it was confusing to people like you and me.
(Note that I'm not trying to dump on the Dylan designers. The
way the original setter syntax worked seems like a mistake (one
that's been corrected) but if you can't have mistakes when you're
developing something, then you'd better possess inhuman genius.)
Quote:
> .... I remember reading in an insert (included in
>the copy of dylan text I got from Apple) a promise to provide
>better setter syntax. Has anyone delivered on this promise yet?
>What might be some alternative syntaxes?
Somewhere I read that the new syntax is:
GETTER SETTER
window-position window-position-setter
table-size table-size-setter
window-color window-color-setter
Marshall Abrams