Feature #14138
closedDefine English.rb aliases by default and eliminate the library
Description
There are many good reasons to simply define all the English.rb global aliases at boot:
- JRuby has done it for years with zero reported bugs.
- Rubinius has done it for years with zero reported bugs.
- Globals are in general discouraged, so the likelihood of collision with a user library is very low.
- The globals that remain are better indicated by using the long name rather than the Perl-esque short names.
- One less library to maintain.
The only argument to not do this seems to be the collision concern, but that has not affected hundreds of users of JRuby and Rubinius over the past decade. I think we're safe.
This would be ideal for 2.5, if it's not too late, since this is the big "gemifying" release. Eliminating English.rb would fit into that well.
Updated by MSP-Greg (Greg L) almost 7 years ago
Charles,
+1
You mentioned several good points. I've got them doc'd in the 'Top Level Namespace' of my doc site so I could find the source, it would be nice if the comments could move there and replace the globals.rdoc file. Along with RDoc picking them up somehow...
Updated by shevegen (Robert A. Heiler) almost 7 years ago
I agree too so +1 from me.
Similar to pp by default, I shied away from suggesting the above
because I assumed that there may be speed issues.
If, however had, there are no considerable speed penalties then,
similar to pp, I'd be all in favour of this.
I never had any concern about collision use myself in the last
~10-15 years of using ruby, in regards to English. But the
extra require line indeed was an obstacle to making use of
English.rb more for me (mostly due to convenience or also
because I may forget it).
Updated by matz (Yukihiro Matsumoto) almost 7 years ago
- Status changed from Open to Closed
We are discussing removing those weird global variables (for Ruby3).
Even if we cannot remove them, we'd like to provide the alternative way to access the info (e.g. Regexp.last_match
for $~
). If any of those variables will survive, I'd love to provide the aliases for those variables. Wait for Ruby3.
I'd close the issue for now.
Matz.
Updated by matz (Yukihiro Matsumoto) almost 7 years ago
- Related to Feature #14240: warn four special variables: $; $, $/ $\ added
Updated by hsbt (Hiroshi SHIBATA) over 4 years ago
- Related to Feature #16963: Remove English.rb from Ruby 2.8/3.0 added