any news on const/invariant?

Sean Kelly sean at f4.ca
Wed Nov 28 08:49:17 PST 2007


Janice Caron wrote:
> On Nov 28, 2007 10:10 AM, Walter Bright <newshound1 at digitalmars.com> wrote:
>> I think it would be pretty hard to give up:
>>
>>         const x = 3;
>>
>> Also, C++ has const as both a storage class and a type constructor, and
>> yes, they have subtly different meanings. This doesn't seem to cause any
>> major problems.
> 
> 
> Actually, I may have been misunderstood, so I want to be clear. There
> is a difference between an ATTRIBUTE and a STORAGE CLASS. C++ has
> storage classes, but D does not. D has attributes, but C++. They are
> not the same thing. The terms are not interchangeable.
> 
> For example, in C++, "typedef" is (syntactically) a storage class, but
> it's certainly not an attribute in D.
> 
> If you want to make the statement
> 
>     const x = 3;
> 
> legal in D

Um, "const x = 3" *is* legal in D.  Has been for about a year now.


Sean



More information about the Digitalmars-d mailing list