| Thread overview | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
June 25, 2020 [Issue 20965] Implicitly generated postblit overrides disabled copy ctor | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20965 RazvanN <razvan.nitu1305@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |razvan.nitu1305@gmail.com --- Comment #1 from RazvanN <razvan.nitu1305@gmail.com> --- You are correct, however, the initial idea was to favor the use of postblits until they are deprecated. If you want to make sure that all copying is disabled, simply do: @disable this(this); @disable this(ref typeof(this)); You don't have to reflect on any code this way. The rule of thumb is: if you want to make sure that a posblit does not get in your way you must defensively disable the postblit and then the copy constructor will have priority. -- | ||||
June 25, 2020 [Issue 20965] Implicitly generated postblit overrides disabled copy ctor | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20965 Max Samukha <maxsamukha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |maxsamukha@gmail.com --- Comment #2 from Max Samukha <maxsamukha@gmail.com> --- Sorry, that's not a good design. If postblit is going to be deprecated, let people gradually prune their codebases of postblits instead of forcing them to add more! -- | ||||
June 25, 2020 [Issue 20965] Implicitly generated postblit overrides disabled copy ctor | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20965 --- Comment #3 from Stanislav Blinov <stanislav.blinov@gmail.com> --- (In reply to RazvanN from comment #1) > @disable this(this); > @disable this(ref typeof(this)); > > You don't have to reflect on any code this way. If I don't want to further infest the codebase with postblits, I have to. > The rule of thumb is: if you want to make sure that a posblit does not get in your way you must defensively disable the postblit and then the copy constructor will have priority. Postblits will never go away then, until they stop compiling. -- | ||||
November 11, 2020 [Issue 20965] Implicitly generated postblit overrides disabled copy ctor | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20965 --- Comment #4 from RazvanN <razvan.nitu1305@gmail.com> --- (In reply to Stanislav Blinov from comment #3) > (In reply to RazvanN from comment #1) > > > @disable this(this); > > @disable this(ref typeof(this)); > > > > You don't have to reflect on any code this way. > > If I don't want to further infest the codebase with postblits, I have to. > > > The rule of thumb is: if you want to make sure that a posblit does not get in your way you must defensively disable the postblit and then the copy constructor will have priority. > > Postblits will never go away then, until they stop compiling. I agree, however, initially you start with tons of codebases that have postblit and 0 that have copy constructor. The DIP [1] explicitly says: "In order to assure a smooth transition from postblit to copy constructor, the following strategy is employed: if a `struct` defines a postblit (user-defined or generated) all copy constructor definitions will be ignored for that particular `struct` and the postblit will be preferred. Existing code bases that do not use the postblit may start using the copy constructor without any problems, while codebases that rely on the postblit may start writing new code using the copy constructor and remove the deprecated postblit from their code." This was Walter's request and I don't think that this will change. [1] https://github.com/dlang/DIPs/pull/129/files#diff-ecee0474c4314cd47dd8c2656b485c0cfd56e704a85de75839ec2850fb61f0ebR282 -- | ||||
November 11, 2020 [Issue 20965] Implicitly generated postblit overrides disabled copy ctor | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20965 --- Comment #5 from RazvanN <razvan.nitu1305@gmail.com> --- I will make a PR to try and fix this and see what happens. -- | ||||
November 11, 2020 [Issue 20965] Implicitly generated postblit overrides disabled copy ctor | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20965 Dlang Bot <dlang-bot@dlang.rocks> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> --- @RazvanN7 created dlang/dmd pull request #11945 "Fix Issues 20714, 20965 - Postblit has priority over copy constructor" fixing this issue: - Fix Issues 20714, 20965 - Postblit has priority over copy constructor https://github.com/dlang/dmd/pull/11945 -- | ||||
November 11, 2020 [Issue 20965] Implicitly generated postblit overrides disabled copy ctor | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20965 Dlang Bot <dlang-bot@dlang.rocks> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #7 from Dlang Bot <dlang-bot@dlang.rocks> --- dlang/dmd pull request #11945 "Fix Issues 20714, 20965 - Postblit has priority over copy constructor" was merged into master: - 40d0661190ac132dbb5d61e3804dd22bbea26602 by RazvanN7: Fix Issues 20714, 20965 - Postblit has priority over copy constructor https://github.com/dlang/dmd/pull/11945 -- | ||||
November 11, 2020 [Issue 20965] Implicitly generated postblit overrides disabled copy ctor | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20965 --- Comment #8 from Dlang Bot <dlang-bot@dlang.rocks> --- dlang/dmd pull request #11947 "Revert PR 11945 (Postblit has priority over copy constructor)" was merged into master: - bc6976a4cc7abe799856689c077406a269dc0c51 by Geod24: Revert "Fix Issues 20714, 20965 - Postblit has priority over copy constructor" This reverts commit c35ace622492da4ca53c055c9af0fa0346aa178b. PR 11945 / this commit introduces a silent change of behavior, which leads to fields with postblit not having their postblit called anymore. A deprecation path was proposed, and would require the user to disable postblit when a copy constructor is present, or issue a deprecation message otherwise. Other options are likely available to avoid a silent behavior change. However, since the PR was merged within 4 minutes of being submitted, there were no time for such suggestions. Additionally, the PR was lacking both a spec PR and a changelog entry. https://github.com/dlang/dmd/pull/11947 -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply