[Grace-core] Super-Outer-Objects: What does your language (gBeta/Newspeak/Scala/Java…) do with this? What should Grace do?

Andrew P. Black black at cs.pdx.edu
Wed Nov 21 21:21:57 PST 2012


On 21 Nov 2012, at 19:51 , James Noble wrote:

> This works though - should it?
> 
> method A {return object {
>       method pathological {print "A-pathological"}  
>       def B = object {
>            method foo {pathological}
>            method bar {A.pathological}
>        }
> }}
> 
> I don't understand the difference here, under either interpretation of the rules about defs, but perhaps I'm missing something


I think that this means

method A {return object {
      method pathological {print "A-pathological"}  
      def B = object {
           method foo {pathological}
           method bar {outer.A.pathological}
       }
}}

and so A is dynamically bound at method request time.  

I don't like the outer notation much, but the meaning seems clear enough.  (I would prefer being able to put a local name for an object between the object keyword and the open brace.  It's essentially a µ binding. )

	Andrew


More information about the Grace-core mailing list