Thread overview
[Issue 17954] init member should be disallowed
Oct 31, 2017
Jacob Carlborg
Oct 31, 2017
Jacob Carlborg
May 11, 2021
Dlang Bot
Dec 17, 2022
Iain Buclaw
Apr 28, 2023
RazvanN
October 31, 2017
https://issues.dlang.org/show_bug.cgi?id=17954

Jacob Carlborg <doob@me.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |doob@me.com

--- Comment #1 from Jacob Carlborg <doob@me.com> ---
I think it's a bit unfortunate that we're moving in this direction and are adding more of these kind of pseudo keywords. I would rather add __traits(init), deprecate the existing usage of "init" and eventually free up "init" to be used as an identifier. The nice thing about __traits is that it's its own kind of namespace and will not cause a conflict with user defined symbols.

--
October 31, 2017
https://issues.dlang.org/show_bug.cgi?id=17954

--- Comment #2 from Steven Schveighoffer <schveiguy@yahoo.com> ---
We are not adding anything. init already is a pseudo-keyword by convention, and is used everywhere. Moving to a __traits addition would be costly (so much code already uses T.init), and not offer really much benefit. Plus it would be disturbingly verbose. It would be a step backwards, IMO.

--
October 31, 2017
https://issues.dlang.org/show_bug.cgi?id=17954

--- Comment #3 from Jacob Carlborg <doob@me.com> ---
The benefit would be less reserved words. I think it was a design mistake from the beginning. Instead of fixing that we're now enforcing what was not really enforced before.

--
October 31, 2017
https://issues.dlang.org/show_bug.cgi?id=17954

--- Comment #4 from Steven Schveighoffer <schveiguy@yahoo.com> ---
That is exactly how I would describe "not much benefit". One less keyword that almost nobody is asking to have removed. I haven't seen much of a demand for using "init" anywhere except to mean what it currently means. This is not like "body," .init is used everywhere and pretty consistently. This is probably due to the fact that if you *do* define an init member, it breaks a lot of things, so you just don't do that. This proposal would formalize that into a more effective error and explanation.

Even though I disagree that .init was a design mistake (I would argue in fact that init should have been a full keyword), it is impossible to go back to the beginning without considering the consequences. Like it or not, we have to consider the effect on existing code when changing the meaning of an existing term.

--
May 11, 2021
https://issues.dlang.org/show_bug.cgi?id=17954

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
@BorisCarvajal created dlang/dmd pull request #12512 "Issue 17954 - init member should be disallowed (deprecation)" mentioning this issue:

- Issue 17954 - init member should be disallowed (deprecation)

https://github.com/dlang/dmd/pull/12512

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=17954

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P4

--
April 28, 2023
https://issues.dlang.org/show_bug.cgi?id=17954

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bitworld@qq.com

--- Comment #6 from RazvanN <razvan.nitu1305@gmail.com> ---
*** Issue 19233 has been marked as a duplicate of this issue. ***

--
June 15, 2023
https://issues.dlang.org/show_bug.cgi?id=17954

Steven Schveighoffer <schveiguy@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #7 from Steven Schveighoffer <schveiguy@gmail.com> ---
Closing based on Walter's comment: https://github.com/dlang/dmd/pull/12512#issuecomment-1592568758

--