On 2013-12-20 01:31:03 +0000, Kenji Hara <[email protected]> said:
2013/12/20 Michel Fortin <[email protected]>
On 2013-12-18 03:42:38 +0000, "Kenji Hara" <[email protected]> said:
http://wiki.dlang.org/DIP49
Improved points from version 1:
- Swap meanings of 'this(this) inout' and 'this(this) const'
- Inout postblit now covers all cheap (== not rebind indirections) copies
between same qualifiers
I can't help but notice that if you want class-typed members to be
assignable in a "this(this) immutable" context you'll need to add
tail-constness for classes in the language.
Sorry I can't understand what you saying. DIP49 does not touch class
reference semantics. It's not a purpose of DIP49.
But what if your struct has a class-typed member:
struct A {
Object o;
int* a;
this(this) {
a = new int;
o = new Object;
}
this(this) immutable {
a = new immutable(int);
o = new immutable(Object); // will that work?
}
}
On the second postblit, the type of "a" has to be "immutable(int)*" to
allow you to assign something else to the pointer while not being able
to affect what's at the other end of the indirection.
So then, what is the type of "o"? Again, you need to be able to assign
the variable while not affecting what is at the other end of the
indirection. You need a tail-immutable object reference, which doesn't
exist.
--
Michel Fortin
[email protected]
http://michelf.ca