www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Last Dobb's Code Talk

reply bearophile <bearophileHUGS lycos.com> writes:
"Non-Nullable References by Default" by Christopher Diggins, on Dr. Dobb's Code
Talk:
http://dobbscodetalk.com/index.php?option=com_myblog&show=Non-Nullable-References-by-Default.html&Itemid=29

Bye,
bearophile
Dec 03 2009
next sibling parent reply "Denis Koroskin" <2korden gmail.com> writes:
On Thu, 03 Dec 2009 18:59:11 +0300, bearophile <bearophileHUGS lycos.com>  
wrote:

 "Non-Nullable References by Default" by Christopher Diggins, on Dr.  
 Dobb's Code Talk:
 http://dobbscodetalk.com/index.php?option=com_myblog&show=Non-Nullable-References-by-Default.html&Itemid=29

 Bye,
 bearophile

Non-nullable references are getting more and more popular. I hope one day we will convince Walter to introduce this idiom to D, too. Unfortunately, it is unlikely for D2 to get this feature in its time-frame (because it will be frozen very soon). Unless we all insist on introducing it before it's too late!
Dec 03 2009
next sibling parent bearophile <bearophileHUGS lycos.com> writes:
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
Dec 03 2009
prev sibling parent Michel Fortin <michel.fortin michelf.com> writes:
On 2009-12-03 11:06:32 -0500, "Denis Koroskin" <2korden gmail.com> said:

 Non-nullable references are getting more and more popular. I hope one 
 day  we will convince Walter to introduce this idiom to D, too. 
 Unfortunately,  it is unlikely for D2 to get this feature in its 
 time-frame (because it  will be frozen very soon).
 
 Unless we all insist on introducing it before it's too late!

Adding non-nullable means a lot of small changes here and there, so I don't believe it'll happen soon. Walter doesn't seem interested, and I find that very unfortunate. Perhaps someone could backport that feature from Delight and propose a patch to Walter? Having something working and in testable state makes a feature much easier to discuss. -- Michel Fortin michel.fortin michelf.com http://michelf.com/
Dec 03 2009
prev sibling parent "Denis Koroskin" <2korden gmail.com> writes:
On Thu, 03 Dec 2009 19:31:06 +0300, bearophile <bearophileHUGS 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.
Dec 03 2009