Logical const

Walter Bright newshound2 at digitalmars.com
Mon Nov 29 15:13:32 PST 2010


Peter Alexander wrote:
> On 29/11/10 8:58 PM, Walter Bright wrote:
>> Because people coming from C++ ask "why not do it like C++'s?"
> 
> No one is asking this.

I interpreted this from Jonathon as asking for it:

"Without immutable, you could presumably get something similar
to what C++ has (if you could ever get Walter to go for it),"

You also wrote:

"I can be sure that my object will come back unmodified. That it is the primary 
purpose of const. Like you said, it allows you to reason about your programs.
Yes, GameObject could be unreasonably mutilated by careless use of mutable, but 
in practice that simply doesn't happen."

Which implies that you regard C++'s system as sufficient. I pointed out 5 
reasons why the "be sure" is incorrect. I believe it is necessary to discuss and 
understand these points in order to justify why D does not adopt C++'s system.


More information about the Digitalmars-d mailing list