Move Constructor Syntax

Derek Fawcus dfawcus+dlang at employees.org
Sun Oct 6 14:57:09 UTC 2024


On Sunday, 6 October 2024 at 12:51:02 UTC, Imperatorn wrote:
> On Sunday, 6 October 2024 at 04:04:28 UTC, Walter Bright wrote:
>> ```
>> struct S { ... }
>>
>> [...]
>
> =this, &this or -this?

I've been partial to the idea of adding the sigil after the name.

this=(S), this<-(S), this~() - the latter being an alternate form 
of destructor.

but I'm not sure how well that would fit in to the existing D 
grammar.

These 'magical' formations were also one of my quibbles with C++.

The other toss up that none of these decorations obviously spring 
out as copy vs move vs construct/destruct, except possibly those 
involving assignment and arrow like graphics, and even those 
could be ambiguous.

So I'd actually favour something which somehow explicitly 
included the words 'move' and 'copy'.


More information about the Digitalmars-d mailing list