Move Constructor Syntax

ryuukk_ ryuukk.dev at gmail.com
Tue Oct 8 07:30:08 UTC 2024


On Sunday, 6 October 2024 at 19:00:09 UTC, Anonymous wrote:
> On Sunday, 6 October 2024 at 04:04:28 UTC, Walter Bright wrote:
>> ```
>> struct S { ... }
>>
>> this(ref S) // copy constructor
>> this(this)  // postblit
>> this(S)     // move constructor
>> ~this()     // destructor
>> ...
>> ```
>> ...
>> A fix that would simplify the language and the compiler would 
>> be to have a unique syntax for a move constructor,
>> ...
>>
>> Something like one of:
>> ```
>> 1. =this(S)
>> 2. this(=S)
>> 3. <-this(S)
>> ```
>> ?
>
> this move(...)
> this copy(...)
> this(...)
> ~this(...)

this is the cleaniest and most understandable syntax, but please 
make them attributes

copy / move are very common keywords, if they become reserved, 
i'll riot

i have no desire to use RAII, literally 0, don't also remove 
words i can use in my code

i already complained about `destroy` being in `object.d` and top 
top it all, it being a freaking template...

it took me DAYS wondering why my destroy function was never 
called despite the program compiling


More information about the Digitalmars-d mailing list