Move Constructor Syntax
Manu
turkeyman at gmail.com
Fri Oct 11 16:14:36 UTC 2024
On Thu, 10 Oct 2024, 17:56 Walter Bright via Digitalmars-d, <
digitalmars-d at puremagic.com> wrote:
> 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.
>
It was because postblit was riddled with problems... (maybe there's a
lesson there?)
Anyway, I thought of an issue with separating the constructor into a
bespoke name; what happens when you do this:
=this(S);
this(S);
Which is selected?
What about:
=this(S);
this(T)(T); which overlaps the concrete case?
This questions also exist in today's language with copy constructors, but
the rules are clear; regular overload selection semantics.
Selecting the proper function to call is a task for overload resolution,
not something weird and special.
If it behaves different than the way you manage the situation based on
regular overload resolution regarding copy constructors, you're just asking
for a raft of special-case related bugs that follow, and suffer more
annoying edge cases which have to be manually identified and managed by the
user.
We need to see the ways that hit dead-ends on the paths you explored.
I want to see the cases that lead to infinite recursions...
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20241012/97d6d21d/attachment.htm>
More information about the Digitalmars-d
mailing list