DIP 1018--The Copy Constructor--Community Review Round 1

Atila Neves atila.neves at gmail.com
Wed Jan 9 14:25:44 UTC 2019


On Saturday, 5 January 2019 at 13:47:44 UTC, RazvanN wrote:
> On Saturday, 22 December 2018 at 16:40:47 UTC, Atila Neves 
> wrote:
>> On Tuesday, 18 December 2018 at 14:51:39 UTC, Mike Parker 
>> wrote:
>>> This is the feedback thread for the first round of Community 
>>> Review for DIP 1018, "The Copy Constructor":
>>>
>>> https://github.com/dlang/DIPs/blob/07da1f2cabc8b1bc3ad66034598a133e5ad13356/DIPs/DIP1018.md
>>>
>>> All review-related feedback on and discussion of the DIP 
>>> should occur in this thread. The review period will end at 
>>> 11:59 PM ET on January 4, or when I make a post declaring it 
>>> complete. (This time I'm extending the review period by a few 
>>> days because of the holidays.)
>>>
>>> At the end of Round 1, if further review is deemed necessary, 
>>> the DIP will be scheduled for another round of community 
>>> review. Otherwise, it will be queued for the Final Review and 
>>> Formal Assessment by the language maintainers.
>>>
>>> Please familiarize yourself with the documentation for the 
>>> Community Review before participating.
>>>
>>> https://github.com/dlang/DIPs/blob/master/PROCEDURE.md#community-review
>>>
>>> Thanks in advance to all who participate.
>>
>> I only realised that there would be a change to move semantics 
>> for structs that define a copy constructor at the end. Can one 
>> still manually move such structs? I'd like the DIP to go into 
>> that.
>
> I think that move and copy constructors are orthogonal concepts.

Perhaps, but moving and copying are not.

> I don't see how copy constructors may affect this.

I didn't either until the example in the DIP:

-----------
struct C { this(ref C) {} }
void fun(C c) {}
void main() {
     C c;
     fun(c);
}
-----------

c is moved before the DIP, and copied afterwards due to the 
existing constructor being considered a copy constructor.

> At this point, there is no move operator in D and the copy 
> constructor is used only when a copy is made. If you are 
> referring to Shackar Shamesh's DIP,

I wasn't referring to opMove, no, but I think adding a `this(C 
c)` constructor to the example would do it for rvalues?




More information about the Digitalmars-d mailing list