[dmd-internals] Questions: how consttructors and postblits work with qualifiers
Jonathan M Davis
jmdavisProg at gmx.com
Wed May 9 02:28:51 PDT 2012
On Wednesday, May 09, 2012 18:10:29 kenji hara wrote:
> Question 4:
> Qualified postblits should work?
>
> struct S {
> this(this) {}
> this(this) immutable {}
> }
> S sm;
> const S sc = sm; // runs this(this)? or runs only blit copy? [X]
> immutable S si = sm; // runs this(this)immutable?
>
> But, with current dmd, multiple postblits conflicts each other.
> Even if should do, I can't imagine how they works in some cases, like
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
More information about the dmd-internals
mailing list