[Grace-core] nesting - what should "self" be when invoking lexically scoped methods
Kim Bruce
kim at cs.pomona.edu
Wed Aug 8 16:37:15 PDT 2012
I agree with Lex. The two versions of foobles are unrelated and the call of m in method runi is really to outer.m
Kim
On Aug 8, 2012, at 4:33 PM, Lex Spoon wrote:
> On Wed, Aug 8, 2012 at 6:55 PM, James Noble <kjx at ecs.vuw.ac.nz> wrote:
>> This code prints "o" twice. Is that what it should do?
>>
>> In particular, shouldn't the call "runi" print "i"
>
> I might be reading it too fast, but I would think two o's is the
> correct output. I'd interpret the bare "m" expressions to be
> equivalent to "theCorrectEnclosingSelf.m". In the outer access to "m",
> "theCorrectEnclosingSelf" is just "self". For the inner access, I'm
> not sure how you'd write it in Grace, but it is the "self" of the
> outer object. In both cases, the call to "foobles" then resolves to
> the method on the outer object.
>
> Looking at it another way, consider the call to "foobles" that occurs
> in m. Statically, this call resolves to the method "foobles" that is
> in the outer object. Dynamically, therefore, the call should resolve
> either to that same method or to some method that overrides it.
> However, nothing overrides it.
>
> Lex
> _______________________________________________
> Grace-core mailing list
> Grace-core at cecs.pdx.edu
> https://mailhost.cecs.pdx.edu/mailman/listinfo/grace-core
More information about the Grace-core
mailing list