Extended Type Design.

kris foo at bar.com
Fri Mar 16 11:48:47 PDT 2007


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.

- Kris



More information about the Digitalmars-d mailing list