[Grace-core] nesting - what should "self" be when invoking lexically scoped methods

James Noble kjx at ecs.vuw.ac.nz
Wed Aug 8 22:20:46 PDT 2012


On 9/08/2012, at 15:26 PM, Lex Spoon wrote:

> Score one for the anti-shadowing rule! That's great that it prevents
> this particular confusing code sample.

well indeed…

> Regarding other languages, Scala and Java have sticky receivers as I
> described. I don't know Newspeak well, but i believe it does the same:
> 
> "When a user defined method f is invoked on an object o in response to a
> message μ, an activation a (3.6) derived from f in response to μ is
> instantiated.
> The current instance of the activation is set to o."
> 
> "For closure activations, the current instance is the current instance
> of the closure p."


that makes sense for direct sends, but implicit sends are different:
they're interpreted as outer sends, which are different again.

Tim was trying to get that going in Newspeak, but hasn't managed it yet.

But to answer your email, I re-read the Newspeak spec, and I think 
it will call foo on the outer object "o".  I think.  We'll see.

So I'm quite glad that nesting doesn't devolve to delegation:
we probably don't want it to.  But the trick is covering
nesting, inheritance, dialects, modules, etc with as 
few mechanisms as possible.

James



More information about the Grace-core mailing list