[Grace-core] Dialect Design Proposal

James Noble kjx at ecs.vuw.ac.nz
Thu Nov 29 02:56:29 PST 2012


On 29/11/2012, at 05:56 AM, Kim Bruce wrote:

> This is NOT the semantics of current class-based object-oriented languages.  Here is the equivalent code in Java:
> If you compile and run it, it will print out "Bottom"

so to - reiterate my tradeoffs list - I don't see how it is possible to have this "class inheritance" semantics,
AND have inheritance from _arbitrary_ objects   in the same language, at least with just one inheritance mechanism.

Inheriting from arbitrary objects means to me that the expression in an "inherits" clause can be any object,
and that expression should have just the same semantics as the expression outside the "inherits" clause.

But the class inheritance semantics explicitly requires the expression to have different semantics if called within an "inherits" clause


The other point I think we should remember is that although this seems like a big, foundational, issue, it is in practice a rather small corner of the language design - we've already changed semantics once here, and it affected only one Grace program (Kim's library).
The compiler itself, GUNIT, my parser combinators, weren't significantly affected by that change.

What's more, this corner is well known to be difficult in a wide range of languages - Java & C++ sure, but also Smalltalk (metaclasses), and even Self - (copy-down vs delegation to traits),  O'CAML (magic inititalisers + no inheritance from objects), JS (just horrid as far as I can tell),

what we have now is not perfect.   that's why it's good that Tim (and others) are proposing alternatives! 

But I'm be quite willing to argue it is no worse than any other extant language design
(and not just because if we knew a clearly better & simpler design, we'd steal it right away!)

and that any other proposal that supports (more-or-less) the existing "class" and "object" syntax
will be (more-or-less) indistinguishable from the current design,  especially for novices. 

J


More information about the Grace-core mailing list