Head Const

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Mon Feb 15 16:14:23 PST 2016


On Mon, Feb 15, 2016 at 11:45:26PM +0000, ZombineDev via Digitalmars-d wrote:
[...]
> >I used the term "tail const" as a mutable pointer/reference to
> >const/immutable object, where transitivity starts from the object
> >(not from the pointer, which is what currently happens if you type
> >`const Object o`).
> 
> Just to clarify:
> struct S;
> const(S)* mutablePointerToS;
> const(S)[] mutableArrayOfConstObjects;
>
> Are examles of tail const. The only missing piece is the ability to
> have a tail-const references to class objects.

Just out of curiosity, since we already have Rebindable in Phobos and
HeadConst is being proposed, what are the disadvantages / shortcomings
of a library solution that would justify adding yet another feature to
the language?


T

-- 
Today's society is one of specialization: as you grow, you learn more
and more about less and less. Eventually, you know everything about
nothing.


More information about the Digitalmars-d mailing list