Extended Type Design.

Sean Kelly sean at f4.ca
Fri Mar 16 12:15:32 PDT 2007


kris wrote:
> Andrei Alexandrescu (See Website For Email) wrote:
>> Benji Smith wrote:
>>
>>> I should also add that, in my opinion, any design where "const" means 
>>> something other than "value resolved at compile time and immutable at 
>>> runtime" would be a mistake.
>>
>>
>> Then how would you call "value that's not mutable through this alias" 
>> in a way that's not going to turn C++ immigrants away?
> 
> 
> there are explicit names for that sort of thing; "immutable", "readonly" 
> , "view" etc.  Reading through the various replies gives the impression 
> that you're concerned about propogating the broken C++ semantics than 
> ensuring D corrects those faults ;)
> 
> I think it's worthwhile ensuring D gets it right instead, and I'll 
> happily change all of Tango to reflect that if necessary. Breaking 
> source-code for a keyword that is currently used rarely is not a 
> problem. Incorrect or dubious/confusing semantics are. It may be 
> worthwhile dumping the "const" keyword altogether, to limit confusion.
> 
> BTW, you've also mentioned changing "inout" to "ref" instead? That would 
> probably break more code than a renaming of const; I know both Tango and 
> Mango use inout quite a bit, but I'm happy to change those as necessary. 
> Other people likely feel the same way.

++vote

For what it's worth, I like: 'final', 'view', and 'const' the best. 
They're all short and meaningful, given the intent for each.


Sean



More information about the Digitalmars-d mailing list