-
-
Notifications
You must be signed in to change notification settings - Fork 668
Temporarily discourage the use of in as a parameter storage class
#10179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thanks for your pull request and interest in making D better, @JinShil! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub fetch digger
dub run digger -- build "master + dmd#10179" |
in as a parameter storage class
RazvanN7
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, but I guess this needs approval from one of the captains.
Geod24
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm strongly opposed to any "temporary discouragement" as mentioned in the linked PR.
Either we fix it or we kill it.
I'm OK with fixing it today. I'm only pursuing the temporary warning as I believe that is what is expected of me. |
|
This is insanity. If this compiler change requires so many changes in Phobos, what about all the rest of D code? There is no way such a breaking change could be accepted. The Phobos/Druntime PRs are just noise and making the code and declarations harder to read. Was this change + all the necessary Phobos and Druntime changes approved by Walter and Andrei? |
That's exaggeration and FUD.
Once again more exaggeration and FUD. If you're using
If only Walter and Andrei would render an opinion on everything we do. If you want to have a say, get involved. |
|
You can't fix a language by breaking all the code written in it. You're not fixing anything, you're just breaking the world.
If it's actually in widespread use, it doesn't matter what the documentation says or what you think. Large-scale code breakage is simply not an option.
This is me getting involved. |
How is changing
You're late. |
No, we can still discuss merging this PR, and revert the Phobos/Druntime PRs. |
|
If you want to change the meaning of |
Fair enough. There are other alternatives to this PR.
Bottom line is we don't need to merge this PR. @Geod24 already voiced opposition to it, and I'm considering the above alternatives to reduce any potential anxiety.
Sounds interesting. I'm not sure how that can be implemented. Please share more details and I'll consider doing the work. |
I think these are good aids but might be insufficient by themselves. I had a look at e.g. vibe.d, and that has roughly 200 instances of using
Here is the implementation for the Lines 3552 to 3586 in b25b676
If you're stuck, Walter and Andrei are generally responsive to emails. (Andrei would be the person to consult about design / semantics / corner cases, and Walter about compiler internals.) |
I can also submit PRs to many prominent repositories. The change is usually very simple and just takes a few minutes. I don't mind picking away at it gradually over the course of a couple years if it will free us from this technical debt.
I understand the general idea, but how does one distinguish between cases where it matters and cases where it doesn't. It seems to me it requires data-flow analysis or the user to state their intent.
Yes, they are, but they've stated to me a couple of times that they can't be bothered with such things. I'm forced to assume that they are quite content with the warts, technical debt, and other weird sh** in the language, and it's therefore on me if I want something done about it. |
That may be true, but I don't know how you intend to redefine
This must have been a miscommunication. It's just not possible for Walter and Andrei to not be bothered about core language changes. |
|
It appears that Issue 16997 was addressed by creating a transition flag that reverted the compiler to the old, incorrect behavior. If the flag was not used, the compiler would exhibit the correct behavior, breaking code. I could implement a transition flag that, when used, reverts Is that what you're suggesting? |
I would avoid using the terms "correct" / "incorrect" here. If a program relied on the old behavior and was known to work correctly, then it would be inappropriate to call the old behavior "incorrect", as "fixing" it would break the program. I'm not sure about the transition flag. Aside the |
I believe I can limit the deprecation warning to parameters that are passed by reference. Then I can add a |
|
I think |
Ok, then what about this:
I'm recommending a deprecation of I could also just implement I would actually prefer |
That sounds good assuming the entire plan is met with approval in general.
Honestly I think you would have a much better chance of going forward with deprecating
Honestly I'm really confused why it has to be me who has to carry out this conversation. There are many people in our community who have a much better understanding of the compiler internals and language semantics than myself, starting with Walter and Andrei who are at the top of the language design responsibility chain, and it bothers me that they all are conspicuously absent in this conversation, and also that everyone seemed to be perfectly OK with all the Phobos/Druntime PRs even though the final destination for which they were created is still unclear. Maybe we're conducting the conversation in the wrong place? |
Andrei stepped down and @atilaneves is now in charge.
It's not the first time this came up on other channels. Never led to any results there.
Walter even did some of these PRs himself a year ago for Phobos when he needed this for DIP 1000. The point was that |
Because everyone else stopped bothering? So I'm very happy that Mike tries to fix the status quo.
|
Maybe welcome to people who don't maintain a hundred thousand lines of D code across dozens of projects and services, but certainly not me! We need to balance the utility and cost of all changes always. Completely deprecating |
For reference, this is what I proposed. We should leave |
Replacing This will also be positive for the language designers and decision-makers. If, and when, a DIP is created, or other decision made about I will implement a We don't need to put a time limit on the new compiler switch, or eventually make the deprecation an error (unless that's what's decide at a later date). What I'm proposing is the equivalent of a public service announcement to help users write more stable, future-proof D code, and provide them with a tool to help them update their existing code, so they can avoid the booby traps that we've currently created for them with regard to Please don't worry about the disruption. I've heard you and I'll make the above accommodations. Please just give me your support by merging my druntime and Phobos PRs so that I can finish the task. Once done, all this controversy surrounding |
|
I'm currently discussing the future of |
|
Why can't |
I also would prefer this option, but as a compromise would it be possible to have |
|
@atilaneves Any updates? |
|
@WalterBright @atilaneves ping |
|
Superseded by #10382 |
|
I somehow missed the pings on this. I replied on #10382 |
An alternative strategy to #10168
inas a parameter storage class is defined asscope const. Howeverinhas not yetbeen properly implemented so its current implementation is equivalent to
const. Properlyimplementing
innow will likely break code, so it is recommended to avoid usingin, andexplicitly use
constorscope constinstead, untilinis properly implemented.The use of
inas a parameter storage class is already discouraged in the documentation. See https://dlang.org/spec/function.html#parameters