Skip to content
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

Suggest global variables #95

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Suggest global variables #95

wants to merge 1 commit into from

Conversation

styd
Copy link
Contributor

@styd styd commented Nov 19, 2017

Hi, @yuki24.
I'm thinking of adding global variables to suggestions.

Previously:

STIN
# NameError: uninitialized constant STIN
# Did you mean?  STDIN
# Nice correction. But, this one
stin
# NameError: undefined local variable or method `stin' for main:Object
# Did you mean?  String

After this commit:

stin
# NameError: undefined local variable or method `stin' for main:Object
# Did you mean?  $stdin

I also cleaned up the list of global variables so that it doesn't start with special characters or numbers that will never trigger NameError in the first place.

@yuki24
Copy link
Member

yuki24 commented Nov 19, 2017

Thanks @styd for taking your time and contributing to DYM!

While it is totally reasonable to suggest $stdin, this seems like a tricky case since Matz wants to get rid of global variables entirely, and this would encourage people to use global variables more. I guess what makes more sense is to only suggest preset global variables and exclude user-defined global variables. However, I'm not sure how other Ruby core members feel about this.

Let me escalate this conversation to the Ruby core team. I'll get back to you once we come up with a conclusion.

@styd
Copy link
Contributor Author

styd commented Nov 20, 2017

@yuki24, it's my pleasure.
You can close the PR if this is a bad practice.
However, I'm really interested in Ruby core team decisions on global variables. Please keep me updated. Thanks.

@yuki24
Copy link
Member

yuki24 commented Nov 23, 2017

We are going to discuss global variables in general at the next Ruby committer meeting. We'll get back to you once we come up with a conclusion, but I feel pretty good about this and we should be able to ship this with Ruby 2.5.

@styd
Copy link
Contributor Author

styd commented Jan 10, 2018

Hi, @yuki24. How did the Ruby committer meeting go? Have you guys decided anything about the global variables?

@yuki24
Copy link
Member

yuki24 commented Jan 10, 2018

Everything's still in the air and we haven't landed on any conclusion yet. One possibility though is that we may deprecate any symbol global variables like $* and make the rest of the predefined global variables reserved words. If this was really going to happen, then we definitely want this PR in and suggest reserved variable names anywhere. This is why I wanted to keep this PR open as it is today. However, this is probably going to be a year-long conversation, so please don't expect an early conclusion.

@styd
Copy link
Contributor Author

styd commented Jan 10, 2018

Ah, I see. No problem. I already expected that it won't be easy to decide this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants