Constant relationships between non-constant objects

Jesse Phillips via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 17 20:36:52 PDT 2014


On Wednesday, 18 June 2014 at 02:26:25 UTC, Sebastian Unger wrote:
> But can you agree that it is AN important use case?

I can't say I support this claim either.

> If so, what was the rationale to not include a feature in D 
> that has been used with great success in other languages?

D had 3 other const systems prior to its current state. This 
system provided the needed guarantees with the least complexity. 
Head-const would have added too much complexity for the benefit 
(almost nothing).

> I'd stronly argue for D getting that feature. If I can't 
> express some of the most basic constructs in OOD in D

Well, I always thought C++'s const was as described in this SO 
response
http://stackoverflow.com/a/2736231/34435

"means this reference cannot be used to modify the instance"

The problem being C++ did not enforce this rule and people 
started abusing it. And now they can't live without it.

But my confession is that I am not and could not ever call myself 
a C++ programmer.


More information about the Digitalmars-d mailing list