Last Dobb's Code Talk

Denis Koroskin 2korden at gmail.com
Thu Dec 3 08:47:23 PST 2009


On Thu, 03 Dec 2009 19:31:06 +0300, bearophile <bearophileHUGS at lycos.com>  
wrote:

> Denis Koroskin:
>> Unless we all insist on introducing it before it's too late!<
>
> I'd like an experimental approach: an lateral branch of DMD2 can be  
> created with this feature. In about a month of its usage I think we can  
> understand if it's a worth feature or not.
>
> Bye,
> bearophile

I believe this feature is hard to implement correctly. Compiler should be  
smart enough and language specs updated to make sure that non-nullable  
references are always initialized.

For example, how would you enforce initialization of non-nullable members?
You can't call any member function until they are fully initialized,  
because those functions might access them while they are in incorrect  
state. This includes calling super(), which leads to bottom to top  
initialization (i.e. subclass is initialized before super class). It also  
means you can't access parent class members before you are fully  
initialized.

There are no such rules in D ATM, but something like this must be  
introduced before non-nullables could be introduced.



More information about the Digitalmars-d mailing list