Implicit context access

Brian Rice water at tunes.org
Mon Apr 11 08:34:37 PDT 2005


On Apr 11, 2005, at 2:57 AM, Tony Garnock-Jones wrote:

> Brian Rice wrote:
>> ...or "here", perhaps.
>
> I like that. Direct, concise, precise, accurate.
>
>>> "thisNamespace" seems initially pretty good, but maybe there are 
>>> better suggestions. Any ideas?
>
> What about some way of naming a context within an expression? For 
> example (strawman):
>
>   x doSomething.
>   here (x doSomethingElse. x doSomethingWith: here).
>   cc (x foo. cc return: 123).
>   x blah.
>
> where the rule is kind of
>
>   NAME_CURRENT_NAMESPACE_EXPR := ID LPAREN EXPRSEQ RPAREN
>
> and the ID is bound to the current context in the EXPRSEQ.

Actually, it would just be a message-send, for example:

n@(Namespace traits) here [n].

This way, it would be accessible as any other implicit-context send.

Now, that would only work on Namespace objects, and that seems like it 
would be sufficient at first. I'm hesitant to dispatch it on root, 
since then we'd have a Smalltalk-80 "yourself" idiom.

But to address your issue, I can just do:

x doSomething.
here `>> [x doSomethingElse. x doSomethingWith: here].
cc `>> [x foo. here return: 123]. "Assuming that cc is a Namespace."
x blah.

Since cascading sets up a new implicit-context, we wouldn't need a new 
grammar rule.

--
Brian T. Rice
LOGOS Research and Development
http://tunes.org/~water/




More information about the Slate mailing list