Copy Constructor DIP

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Jul 13 01:18:48 UTC 2018


On 7/12/18 2:30 PM, ag0aep6g wrote:
> On 07/12/2018 03:40 PM, Andrei Alexandrescu wrote:
>> On 07/10/2018 04:58 PM, Manu wrote:
> [...]
>>> 1. Explain the need and reasoning behind `@implicit`.
>>
>> Razvan: I think it would help to explain that the attribute is 
>> necessary to avoid changing semantics of existing code. Thanks.
> 
> You're still potentially changing the semantics of existing code. 
> `@implicit` can be a UDA today:
> 
> ----
> enum implicit = 0;
> struct C
> {
>      @implicit this(ref C another) {}
> }
> ----
> 
> Today, that's a normal constructor. With the DIP, it becomes a copy 
> constructor.

That is correct and a liability of the current DIP. That should be 
mentioned in it.


More information about the Digitalmars-d mailing list