January 05, 2008
Walter Bright wrote:
> 
>> Head constness needs to
>> be dropped here, exactly as it is dropped in template distinction in
>> D2.008 (t!(int) is the same thing as t!(const(int)) unless special
>> syntax is used).
> 
> The problem with head const is that to make the concept work, you also need the concept of tail const, and you also need to be able to separately manipulate head & tail const. That's how D's first cut at const worked, and it was a disaster.
> 
> Just for fun, how would we define a tail const member function?
> 
> 

One wouldn't, because that does not make sense. More exactly, it does not make sense to change the 'this' implicit parameter(as in "this = foo"), so the "head" value of 'this' is always immutable. This means that in a member function, the 'this' parameter should always be either head const, or head+tail const, but never just tail const. Isn't it so?

-- 
Bruno Medeiros - MSc in CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
7 8 9 10 11 12 13 14 15 16 17
Next ›   Last »