-
-
Notifications
You must be signed in to change notification settings - Fork 668
Add -transition=in compiler flag to help users transition away from using in
#10382
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#10382" |
|
Should the message also be emitted for disabled code? If not, the check needs to be done during semantic analysis. |
|
I still don't understand why we can't simply redefine "in" as "const scope" when -dip1000 flag has been applied. Deprecating "in" seems to me a bad decision giving that "inout" and "out" still exist. |
|
Please understand that we're not deprecating Right now we're sabotaging users by not informing them to stay away from |
I argue it should, because the goal here is to inform the community that the future of |
I was thinking about projects that try to support a range of compiler versions using conditional compilation for constructs that work differently across different versions. |
-transition=in compiler flag to help users transition away from using in-transition=in compiler flag to help users transition away from using in
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.
My objection still stands: We should leave it as is before we have a proper plan for it. Using transition means we are going to change something, in a way that can't be easily deprecated. Here we don't have a plan of timeline for it.
I was not a fan of changing every instance in Phobos & druntime, because it felt like just noise, but it's still things under our control so it matters less than affecting all the D code out there.
I still think this is the right thing to do to avoid sabotaging users and to allow designers the liberty to design and implement |
-transition=in compiler flag to help users transition away from using in-transition=in compiler flag to help users transition away from using in
|
No longer WIP, and ready to go. |
There's a plan for it. The plan is to make |
Sounds good to me. |
Then there's no need to discourage its usage, instead just provide a transitional switch to make it means what it was supposed to mean. Or pack it with |
Precisely.
The plan is to pack it in with dip1000.
I didn't think they should have been removed at the time, but I had to talk to Walter first to know if he'd agree with my plan. |
|
@atilaneves Once |
|
@JinShil Yes, but only with DIP1000, which is optional and creates a time period for not breaking. Do you have any suggestions on how to handle those two breakages? |
I don't know what to do about dlang/druntime#2685 (comment) yet, but perhaps you could get @WalterBright on the horn and ask him if #10223 could be a solution to Issue 20087. I also might be able to do the implementation of |
|
@atilaneves Also, this is another situation that doesn't build. If you could tell me how the compiler should behave, I might be able to fix it. |
|
@atilaneves can we also have See also: |
|
@ZombineDev I'd have to think about that. A lot. I assume by |
struct Huge { /* ... */ }
void foo(in Huge val); // This is equivalent to `foo(const scope ref Huge val)`
void foo (in ushort); // This is equivalent to `foo(const scope ushort)`Basically, if you're passing an |
Nope, I meant both template and non-template functions. Currently What I propose is (I hope) much simpler. You would be able to define both template and non-template functions, virtual methods, function pointer and delegate types, etc. just like you can today. In short, I think that Note: It's technically not a full replacement because I've seen people mutate |
|
Interestingly I had the exact same discussion with @JinShil a few weeks ago. Should there be a DIP for that ? |
I think that a copy happening or not is orthogonal to it being an |
|
@Geod24 Yes, I think a DIP would be needed. |
You could apply the same line of reasoning in order to ask for Also this part:
Is not true, because we would also need to change the semantics of
(I use |
A "gentler" alternative to #10179
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