What's wrong with:
struct S {
  this(ref S copyFrom);
}

That looks like a perfectly good copy constructor declaration ;) I'm just saying, the DIP needs to explain this.

That is actually a valid constructor, according to today's compiler. There might be code out there that uses this syntax for the constructor and overnight
it will be turned into a copy constructor.

I agree that the current syntax is lacking. This was Andrei's proposition and I was initially against it, but he said to put it in the DIP so that
we can discuss it as a community. Maybe this syntax is better:

@this(ref S a another)

It looks like the c++ copy constructor but the `@` makes it different from
a constructor, so we're good. What do you think?

Right. This is all obvious and intuitive.
What I'm hearing is that under this proposal, copy constructors and assignment operators DO come in pairs (just like in C++), but that's not mentioned here in this DIP. Since this proposal will introduce
that recommended pattern from C++, it may be worth mentioning.

If by "come in pairs" you mean that you can define them both, then yes,
that is the case. Will add a paragraph in the DIP to specify this.

You mentioned that it's terrible that the assignment operator
and the copy constructor come in pairs. Why is that? Would you rather have a copy constructor that is used also as an assignment operator?

Reply via email to