[Grace-core] Dialect Design Proposal

Marco Servetto marco.servetto at gmail.com
Wed Nov 28 13:44:36 PST 2012


>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 also print out "Bottom"
> If you know another class-based language that gives a different answer, please let me know.

C++

In C++ objects changes the dynamic type during construction, and so
you can obtain exactly what the james example is doing.

While *many researcher* consider some details of C++ semantic
misleading, is also true that C++ is still one of the most used
programming languages, so that the concept of
*conventional class base inheritance semantic during construction* is
simply undefined.


> I can imagine a language which decides not to allow self-calls until the object is fully constructed,
> but that really ties your hand behind your back.

That is my proposal indeed, I strongly believe that such solution
would be perfect.
I do not think such decision would ties the hand, on the other side,
this discipline would promote good initialization design patterns as
factory and builder.
And if grace syntax can support such patterns in a... graceful way,
that I think there is no disadvantage at all in such discipline.


More information about the Grace-core mailing list