Head Const

w0rp via Digitalmars-d digitalmars-d at puremagic.com
Mon Feb 15 23:46:11 PST 2016


I think the point about name mangling is very true. That's the 
most important thing, being able to call all of the C++ functions.

I personally love that const and immutable are transitive in D. I 
get annoyed in other languages when I have const objects 
containing mutable objects, and no real protection from the 
compiler from stopping the objects in the inside from being 
mutated. The way I see it, C++ const is a weaker form of const 
which doesn't complain about mutations enough.

I think if we could avoid putting head const in the language, 
we'd be better off. If you ever really, really need to mutate 
something inside a const type, you can cast away const. It will 
rightly look ugly, and the compiler can complain that it's not 
@safe.


More information about the Digitalmars-d mailing list