The Status of Const

Steven Schveighoffer schveiguy at yahoo.com
Mon Aug 16 05:14:34 PDT 2010


On Fri, 13 Aug 2010 19:30:46 -0400, dsimcha <dsimcha at yahoo.com> wrote:

> == Quote from Jonathan M Davis (jmdavisprog at gmail.com)'s article
>> On Friday, August 13, 2010 15:03:07 Tomek Sowiński wrote:
>> > I agree with the content, but not the tone. D's const makes all other
>> > mainstream const systems look petty. Applying the concept of  
>> transitivity
>> > has been revolutionary (hail Walter). Tail const is just a cable to  
>> the
>> > socket to make this wonderful device work out-of-box for programming
>> > masses.
>> In pretty much all cases other than references, D's const system is  
>> fantast
>> ic.
>> It really simplified things in comparison to C++, and is overall a  
>> definite
>>
>> improvement. It's just with references that there's a big problem, and  
>> with
>>
>> them, they're better than what you get with Java's final, but it's still
>> seriously lacking due to the whole thing becoming const instead of just  
>> the
>>
>> referent.
>> - Jonathan M Davis
>
> I still don't understand:  What's so bad about Rebindable?  Yes, it's  
> not the
> syntactically prettiest thing in the world, but complaining about it is  
> like
> complaining about climbing a molehill when you've got Mount Everest to  
> climb next.
>  My previous gripe about it was that it didn't support interfaces, but I  
> just
> realized that Shin Fujishiro fixed this a while back.

There are other reasons to have tail-const other than classes.  For  
example, there's no equivalent custom-range idiom for const(T)[].  You  
simply can't make a custom range tail-const.

I admit I haven't used Rebindable much, but last I checked it was severely  
out of date.

-Steve


More information about the Digitalmars-d mailing list