What if D would require * for reference types?

Michel Fortin michel.fortin at michelf.com
Mon Jan 18 08:17:53 PST 2010


On 2010-01-18 10:08:34 -0500, "Denis Koroskin" <2korden at gmail.com> said:

> It's as simple as that: require '*' to denote reference type. What does 
> it  give?

It works like that in Objective-C where object variables must always be 
pointer to objects (enforced by the compiler), and it's not so bad. 
It's undoubtedly cleaner to read without '*', but as you illustrate it 
cause issues.

> 3) No more issues with tail-const, tail-shared, tail-immutable; 
> deprecate  Rebindable (this one was recently discussed):

That's the issue that bothers me most about the current syntax. 
Rebindable is a nice trick, but it's a hackish solution thrown at a 
syntactic problem. And it's not so rare either when you're working with 
immutable objects. It'd be much better if the syntactic problem didn't 
exist in the first place. Compare this

	Rebindable!(immutable Object) object;

to this:

	immutable(Object)* object;

The second is much easier to read. By getting rid of this template 
trickery playing with the type system and replacing implicit references 
with the almost identical concept of pointer, I think we would make the 
language easier to grasp.

Are we too late in D2 development to make this change? I'm in support of it.


-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list