mutable reference to const object

bearophile bearophileHUGS at lycos.com
Thu Mar 6 09:47:32 PST 2014


Vadim Lopatin:

> Const sub-tree is object itself and its data.
> Reference to object is outside of tree.
> Why references to const object should be const?

There was a very long discussion on this. I think the short 
answer is to keep the syntax and semantics composed of a 
sufficiently low number of parts (in D you don't have syntax to 
tell apart objects from their references).

A D user wrote a patch to implement what you ask for, but it was 
essentially left to die in GitHub.

But there's Rebindable in Phobos.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list