Copy Constructor DIP
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Thu Jul 12 15:33:03 UTC 2018
On 07/12/2018 11:25 AM, Luís Marques wrote:
> On Thursday, 12 July 2018 at 15:14:19 UTC, Luís Marques wrote:
>> More details. The DIP says:
>>
>> "The structName type needs to be identical to typeof(this); an error
>> is issued otherwise. This requirement may be relaxed in the future in
>> order to accomodate copying from objects of a different type"
>> (BTW, typo in "accomodate")
>>
>> That would mean that if such a relaxation were introduced, then
>> suddenly *all* copy ctors would imply implicit conversion between the
>> respective types. Given D's stance on implicit conversions, I suspect
>> that's not going to pass mustard. So I would prefer the any "implicit"
>> keyword-like annotation to be reserved for explicitly approved
>> implicit conversions.
>
> BTW: Multiple alias this is still planned for inclusion in D, right? If
> so, what would be the (pratical?) difference between having copy ctors
> with such a relaxed type requirement and just defining an equivalent
> alias this method? In case the answer is that there's no significant
> difference, why not drop multiple alias this, then?
Again: not the charter of this DIP, so you should ask yourself, not us,
this question.
More information about the Digitalmars-d
mailing list