On Sun, 07 Nov 2010 18:12:50 -0500
bearophile <bearophileh...@lycos.com> wrote:

> retard:
> 
> > I bet even the basic class/interface/exception system of D is too complex 
> > to explain for some members of the audience. You can't assume that the 
> > same people who *use* the language can/want to understand the 
> > implementation of the features.
> 
> You are right. The people that use the language&compiler don't need to 
> understand it fully. So are nonnull references too much hard to use? Their 
> syntax is simple. The limited typestate they need to be implemented well is 
> easy to use by the programmer. The initialization of collections is simple 
> enough to understand, in my opinion. So what's left is the delayed types. So 
> in the end I think that you are right, once well implemented the nonnullables 
> in D may be usable by normal programmers, despite they add some complexity to 
> the language.

I'm unsure of that. For the implementation, sure; but are all wasinhg machine 
users specialists in fluid dynamics? The semantic side on the other hand seems 
clean to me (or, maybe I don't get it right myself).

Imagine pointers in a language where one cannnot declare vars without init. 
Then, one would either make one pointer point to an existing var, or to a newly 
allocated "target cell"; itself initialised explicitely (or by the language's 
init value for that type). Something like

auto p = &n;
auto p = &(new int = 1);

auto p = &(new int);    // *p == 0

Then, you have no null ref. Or do I miss a point? An equivalent of the second 
form is verboten in D, I guess, because there is no lvalue. It could be avoided 
by requiring a temp var for the target.
By the way, is it always possible to avoid pointer declarations without init, 
or are there cases where one must have this feature? In other words, is the 
whole null-ref feature just convenience?


Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com

Reply via email to