About Smalltalk at: .... ifAbsent:/present:
Andreas Raab
andreas.raab at gmx.de
Tue Nov 30 15:39:18 UTC 2004
> Now... I don't really know what I am talking about - but is this in fact
> a special case of something bigger, something similar to hygienic macros
> or whatever it is called? (Slate, Scheme etc) I mean, some way of
> manipulating the AST of the code itself (which is my very shallow
> understanding of what that is)?
That is precisely right. It is easy to see how one would generalize the
behavior to something like, e.g.,:
"Tell the variable var how to retrieve and store its value"
&var toGet: [self instVarAt: 1]
&var toSet: [:newValue| self instVarAt: 1 put: newValue].
Accessing variables is then conceptually equivalent to:
&var value. "read value of variable"
&var value: newValue. "write value of variable"
With the compiler merely inlining the definitions of the accessors.
Cheers,
- Andreas
More information about the Squeak-dev
mailing list
|