Move Constructor Syntax

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Mon Oct 7 00:16:33 UTC 2024


On 07/10/2024 12:09 PM, Richard (Rikki) Andrew Cattermole wrote:
> On 07/10/2024 5:56 AM, Walter Bright wrote:
>> On 10/6/2024 2:58 AM, Richard (Rikki) Andrew Cattermole wrote:
>>> Does that not have desirable potential additions, once move 
>>> constructors have been resolved?
>>> For now, it can error if seen elsewhere.
>>
>> I know you've proposed @move for parameters already, but this seems 
>> inconsistent with that.
> 
> For parameters yes, I'd prefer that a copy constructor turned into a 
> move constructor wasn't some special thing. But if you really want it to 
> be a different overload set, well do it on the function to define it.
> 
> ```d
> this(ref Thing other) @move {
> }
> ```

There is a very good reason to prefer an attribute rather than new 
syntax, it doesn't break tooling.



More information about the Digitalmars-d mailing list