Copy Constructor DIP and implementation
Nicholas Wilson
iamthewilsonator at hotmail.com
Wed Sep 19 01:15:20 UTC 2018
On Wednesday, 19 September 2018 at 00:05:15 UTC, Jonathan M Davis
wrote:
> On Tuesday, September 18, 2018 10:58:39 AM MDT aliak via
> Digitalmars-d- announce wrote:
>> This will break compilation of current code that has an
>> explicit copy constructor, and the fix is simply to add the
>> attribute @implicit.
>
> In that case, why not just use a transitional compiler switch?
> Why force everyone to mark their copy constructors with
> @implicit forever? The whole point of adding the attribute was
> to avoid breaking existing code.
>
> - Jonathan M Davis
Apparently because extending copy constructors are intended to be
extended to types other than typeof(this), which would also be
implicit, and then @implicit is to make sure that you actually
want this(ref SomethingElse){ ... } to be implicitly called when
A a;
B b;
...
b = a;
which I think is a bad idea, not the least of which is because
thats what opAssign is for.
See https://github.com/dlang/DIPs/pull/129#discussion_r218006614
More information about the Digitalmars-d-announce
mailing list