[Grace-core] Super-Outer-Objects: What does your language (gBeta/Newspeak/Scala/Java…) do with this? What should Grace do?
James Noble
kjx at ecs.vuw.ac.nz
Wed Nov 21 21:27:01 PST 2012
On 22/11/2012, at 18:21 PM, Andrew P. Black wrote:
> 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.
right. I just don't see why that works for methods (some of the time) and not e.g. for defs even if they are readable, public…
That may be just a big
> I don't like the outer notation much, but the meaning seems clear enough.
right.
> (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. )
yep. OCaml does this, Newspeak actually does "outer C.foo" where "C" is the name of the class, because, well it is class based.
Newspeak's object literals apparently aren't implemented so I don't know how they'd work there.
The main reason I'm not sold on this is that it adds more complexity, isn't used that much, and gets confusing - compare
def A = object { …
with
object A { …
Should the second form add something to the surrounding object, like "class A" and "method A" would?
James
More information about the Grace-core
mailing list