Literal object syntax
Tony Garnock-Jones
tonyg at lshift.net
Tue Jul 18 17:29:06 UTC 2006
Andreas Raab wrote:
> This of course gets more interesting when you need more than single
> parametrized method but the above illustrates the basic idea.
The other interesting part is the scoping of free identifiers within
methods in the literal-object. Does a literal-object close over its
environment like a block? Like a closure? Not at all? How are
literal-objects initialized? Do they have instance variables?
There are *lots* of interesting variations in exactly *how* to treat
free identifiers...
The whole idea is, I think, a good one - blocks themselves (well, more
properly, closures) become special-cased syntactic sugar:
[stuff] ===>
def Block [
value [
^ stuff
]
]
[:a | a + 1] ===>
def Block [
value: a [
^ a + 1
]
]
It also introduces the thorny notion of naming partial continuations.
(As in, which continuation does ^ throw to?)
Cheers,
Tony
More information about the Squeak-dev
mailing list
|