Copy Constructor DIP

ag0aep6g anonymous at example.com
Thu Jul 12 18:30:21 UTC 2018


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.


More information about the Digitalmars-d mailing list