Literal object syntax

Tony Garnock-Jones tonyg at lshift.net
Wed Jul 19 08:50:19 UTC 2006


Tony Garnock-Jones wrote:
> Could we instead use
> thisContext for finer control, and make ^ some kind of sugar for such use?

It turns out this is (of course!) already possible:

  someMethod
    | leave |
    leave := thisContext.
    leave return: 3.
    ^ 4

... will always return 3. Lexical scoping can now be used to precisely
target a particular context.

The rule for exactly which context ^ targets (outermost visible?
outermost named-method?) with literal-object syntax is a free choice, I
guess.

Hooray for fully reflective languages!

Cheers,
  Tony




More information about the Squeak-dev mailing list