The Status of Const

Steven Schveighoffer schveiguy at yahoo.com
Fri Aug 13 06:53:58 PDT 2010


On Fri, 13 Aug 2010 09:32:49 -0400, Steven Schveighoffer  
<schveiguy at yahoo.com> wrote:

> On Fri, 13 Aug 2010 01:46:51 -0400, Kagamin <spam at here.lot> wrote:
>
>> Walter Bright Wrote:
>>
>>> Graham St Jack wrote:
>>> > However, I still regard the language design decision of a class
>>> > reference having the same constness as the object it refers to as a
>>> > major language design problem.
>>>
>>> We tried for months. It just doesn't work to make it any other way  
>>> than it is now.
>>
>> Is it compiler infrastructure's or syntactical issue?
>
> Syntactical.  There is no way to separate the reference from the data,  
> since the reference is a hidden artifact of the type system.
>
> With pointers it is easy, you apply const to the data, and not the  
> pointer.  With arrays, same thing.  I don't want to open up another  
> discussion of how to do it, we tried and tried for months with different  
> proposals, and nothing seemed very good.  The only thing which would  
> work IMO is another const keyword.

Or rather another const, immutable and shared kewords.

-Steve


More information about the Digitalmars-d mailing list