const(X) member of Y

Dan dbdavidson at yahoo.com
Fri Feb 8 04:07:54 PST 2013


On Friday, 8 February 2013 at 04:41:42 UTC, deadalnix wrote:
> Well because it is known what have to be done for a while. It 
> is "just" not implemented.

If it is known then please tell the plan. I see many conflicting 
points and I don't see the clean solution that maybe you do.

Just from this thread we have that 'this(this) const' is kind of 
a mistake and not defined in the docs. Yet in certain cases that 
is a required signature.

Repeating this from:
http://forum.dlang.org/thread/CAFDvkcvvL8GxHQB=Rw9pTm-uxOKzNGVQNDv9w5Os3SkQCc=DLQ@mail.gmail.com

    > Qualified postblits make no sense, given that if
    > the object is const or immutable, you _can't_
    > alter it without violating the type system. But
    > without them, you can't copy const or immutable
    > objects which require a postblit.  Walter and
    > Andrei have stated in the past that they had a
    > plan for solving this, but AFAIK, they've never
    > actually revealed what it is. My best guess would
    > be to introduce copy constructors for const and
    > immutable objects, but I don't know. Regardless,
    > this is a situation that definitely needs to be
    > clarified and properly sorted out.
    >
    > - Jonathan M Davis

Ultimately, though it would be great to know not just what can't 
work or what might work but what the long term solution is.

Is there a solution ironed out between Andrei and Walter and if 
so what is it, roughly?

What is the priority of this issue, where the issue is not 
necessarily the implementation but letting us know where it is 
going so we can not do something silly?

Realistically, when const gets too much in the way one recourse 
is to drop it. On the other hand if a solution is in the works 
and delegate trickery is just a stop gap it's less worrisome.


Thanks
Dan


More information about the Digitalmars-d mailing list