Feature #14138


Define English.rb aliases by default and eliminate the library

Added by headius (Charles Nutter) over 5 years ago. Updated over 5 years ago.

Target version:


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.

Related issues 2 (0 open2 closed)

Related to Ruby master - Feature #14240: warn four special variables: $; $, $/ $\Closedjeremyevans0 (Jeremy Evans)Actions
Related to Ruby master - Feature #16963: Remove English.rb from Ruby 2.8/3.0Closedhsbt (Hiroshi SHIBATA)Actions

Updated by MSP-Greg (Greg L) over 5 years ago



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) over 5 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) over 5 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.


Actions #4

Updated by matz (Yukihiro Matsumoto) over 5 years ago

  • Related to Feature #14240: warn four special variables: $; $, $/ $\ added
Actions #5

Updated by hsbt (Hiroshi SHIBATA) almost 3 years ago

  • Related to Feature #16963: Remove English.rb from Ruby 2.8/3.0 added

Also available in: Atom PDF