Copy Constructor DIP

Manu turkeyman at gmail.com
Tue Jul 10 20:58:09 UTC 2018


On Tue, 10 Jul 2018 at 03:50, RazvanN via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> Hi everyone!
>
> I managed to put together a first draft of the DIP for adding the
> copy constructor to the language [1]. If anyone is interested,
> please take a look. Suggestions and comments about technical
> aspects and wording are all welcome.
>
> Thanks,
> RazvanN
>
> [1] https://github.com/dlang/DIPs/pull/129

I feel there's some things missing.

1. Explain the need and reasoning behind `@implicit`... that's weird
and I don't like it at face value.
2. It looks like copy constructors are used to perform assignments
(and not constructions)... but, there is also opAssign. What gives?
    Eg:
      S b = a; // <- copy construction? looks like an assignment.
    And not:
      S b = S(a); // <- actually looks like a construction, but this
syntax seems to not be intended (and rightly so, it's pretty terrible)
3. In C++, copy constructors and copy assignment operators come in
pairs (which is totally lame!), but we don't see that same pattern
extend here, and it's not clear at all why.
4. Given the special rules where assignments are lifted to
constructions, I want to know when that occurs (maybe that is already
spec-ed wrt postblit?)

- Manu


More information about the Digitalmars-d mailing list