-
-
Notifications
You must be signed in to change notification settings - Fork 749
makeGlobal: Use an enum instead of magic numbers #5724
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, @MetaLang! We are looking forward to reviewing it, and you should be hearing from a maintainer soon. Some tips to help speed things up:
Bear in mind that large or tricky changes may require multiple rounds of review and revision. Please see CONTRIBUTING.md for more information. 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. |
std/stdio.d
Outdated
| } | ||
|
|
||
| // Undocumented but public because the std* handles are aliasing it. | ||
| @property ref File makeGlobal(int _iob)() |
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.
Would it be bad to make the enum an actual type, and then make the template parameter an instance of that enum? This would prevent for instance makeGlobal!5, which then also aliases to stderr without something like that. At the very least, this should say if(_iob >= stdin_handle && iob <= stderr_handle)
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.
Yes, I'll do that instead. My goal was to be as unintrusive as possible.
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 not an expert on whether this will trigger -betterC problems, but this looks much better to me.
|
I believe we should be okay now that |
|
I'm just looking at the doc changes, I didn't realize the instantiation makes it into the docs. Something to think about for another PR I think. |
|
I'm planning on nuking most of |
|
@ZombineDev while I'll warn you that std.stdio is a nest of hacks that is really difficult to untangle. I hope you can do it, but I definitely don't have much hope. |
|
@ZombineDev I don't think it's a huge issue since this is such a simple PR. The code is working as-is so it doesn't matter if this gets merged or not; I just thought I'd fire a quick PR off based on Steven's comment here. |
|
Alright, in that case feel free to proceed with this PR, as I can't give an ETA on my work, and as Steven points out we should strive to improve the status quo with what we have. |
No description provided.