References to const

Jonathan M Davis jmdavisProg at gmail.com
Thu Nov 13 01:46:59 PST 2008


Robert Fraser wrote:

>> 
>> Thanks for the info.  It would be nice if variable references to constant
>> data were built into the language, but as long as Rebindable works, at
>> least it's possible to have them.
>> 
>> 
>> - Jonathan M Davis
> 
> Many wars were fought at one point about exactly this, and, indeed D
> 2.000-2.007 had it built into the language. Then Walter decided it would
> be too confusing for there to be both a head-const ("this thing is
> const") and a tail-const ("whatever this refers to is recursively
> const"). Thus, we ended up with the system we have today.

Well, it's certainly confusing enough in C++ and I don't see a nice, clean way to do it, so I can certainly understand deciding against having it built in - as nice as it might be if it were.

- Jonathan M Davis



More information about the Digitalmars-d mailing list