Discussion Thread: DIP 1040--Copying, Moving, and Forwarding--Community Review Round 1

tsbockman thomas.bockman at gmail.com
Wed Mar 10 22:51:58 UTC 2021


On Friday, 5 March 2021 at 23:03:57 UTC, tsbockman wrote:
> On Friday, 5 March 2021 at 12:19:54 UTC, Mike Parker wrote:
>> This is the discussion thread for the first round of Community 
>> Review of DIP 1040, "Copying, Moving, and Forwarding":
>
> From the DIP:
>> A Move Constructor for struct S is declared as:
>>     this(S s) { ... }
>> A Move Assignment Operator for struct S is declared as:
>>     void opAssign(S s) { ... }
>
> Is the parameter to these methods really pass-by-value?
> ...
> If the parameter is, in fact, intended to be pass-by-reference, 
> then I must strenuously object to the chosen syntax.

Over in the feedback thread, Atila Neves also concluded that the 
syntax is misleading here:

On Wednesday, 10 March 2021 at 21:27:25 UTC, Atila Neves wrote:
> I eventually understood what this meant, but this confused me 
> when I read it the first time. I'd reword it to mention that 
> the syntax looks like a by-value parameter but ends up being 
> passed by reference. It also confused me that the 2nd function 
> had `ref` in there.

Am I the only one who thinks that it would be better to have 
syntax that accurately reflects the semantics, instead of just 
documenting "this syntax is a lie"?


More information about the Digitalmars-d mailing list