[Grace-core] Fwd: minigrace oddness
Kim Bruce
kim at cs.pomona.edu
Wed Jun 25 16:59:47 PDT 2014
Makes sense. Thanks! I had forgotten that we needed to get exactly the right number of outer's.
I'm wondering if perhaps we might want to have a marker for things available at a certain level or above. What I found confusing in my example was that "for" was clearly available in the outer scope, yet I couldn't get it via outer.for. Perhaps it would make sense to allow programmers to write outer+.m to refer to an m available via some number of outer's -- i.e. to access something that is visible in the outer scope.
Just a thought.
Kim
On Jun 25, 2014, at 4:50 PM, Timothy Jones <tim at ecs.vuw.ac.nz> wrote:
> On 25/06, Kim Bruce wrote:
>> Is this the right thing that should happen? While "for" is a built-in control
>> structure, I would have assumed that it would be treated as a top-level
>> method, at least enough so to get access with an "outer". Of course this may
>> just be an accidental issue with the current minigrace implementation. What
>> do we want the answer to be? My inclination is that annotating it as "outer"
>> should have worked, but I'd be happy to hear arguments to the contrary.
>
> The outer reference gives you the self object at the relevant scope. In this
> case, outer refers to the module object, and for() do() is not defined there, it
> is defined in the scope above that. 'outer.outer.for() do()' is what you are
> looking for.
>
> The prelude has a definition named 'prelude' in it that refers directly to the
> prelude object, so 'prelude.for() do()' is probably what you really want here.
>
> --
> Tim
More information about the Grace-core
mailing list