About Smalltalk at: .... ifAbsent:/present:
goran.krampe at bluefish.se
goran.krampe at bluefish.se
Tue Nov 30 14:09:05 UTC 2004
Hi!
"Andreas Raab" <andreas.raab at gmx.de> wrote:
> > So given that - how do we fix it? Introduce a new way to refer to
> > "globals", some kind of "binding" object?
>
> The simplest way is probably to introduce a pseudo-operator like for
> example, "&" to refer to the binding object. For example:
>
> &Foo isUndeclared "answers true if binding is undeclared"
> &Foo ifUndeclared:[...] "eval if binding is undeclared"
> &Foo ifAbsent:[...]. "eval if binding's value isn't present"
>
> etc. with &Foo being a simple compiler hack which instead of emitting
> pushLiteralVariable bytecode (e.g., pushing the value of the binding) merely
> emits pushLiteralConstant (e.g., pushing the binding itself).
Given my foray into Compiler land (Namespaces package) this doesn't seem
hard to do at all.
In fact, I get very tempted. :)
> (note that in order to do this it would be extremely worthwhile to get away
> from using Associations and instead make some specific VariableBinding
> objects which implement the above methods)
Right.
> Cheers,
> - Andreas
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)?
Just curious.
regards, Göran
More information about the Squeak-dev
mailing list
|