Move Constructor Syntax
Walter Bright
newshound2 at digitalmars.com
Thu Oct 10 07:55:07 UTC 2024
On 10/8/2024 11:54 PM, Manu wrote:
> Hmmmm. Well, that's not and never was a copy constructor...
Well, it is. I don't recall when or why it was included in D.
> so are we required to accept that that was ever correct code?
Yes. I'm not willing to endure the legions of people saying I broke their code,
and the fix for them is not obvious. The way some people use D is terrifyingly
(to me) over-complicated with templates and aliases and trampolines and
forwards, etc.
So I embarked on "how can I make this as simple and understandable as possible".
> What kind of problem is a result of copy constructors not having an identifier?
Being unable to tell if `this(S)` is a copy constructor or not without semantic
analysis.
BTW, with the prototype implementation of move constructors, move constructors
get a separate identifier, `__moveCtor`, so it is usable from system code.
The way the symbol table works, and all the overloads and templates, attempting
to search all the `__ctor` functions looking for the move constructor is very
inefficient.
BTW, every reply you make starts a separate subthread. Can you please fix that?
More information about the Digitalmars-d
mailing list