Issue #17830 has been updated by duerst (Martin D=FCrst).

Assignee set to matz (Yukihiro Matsumoto)

As Matz gets cited more and more, I think it's best to let him decide.

----------------------------------------
Feature #17830: Add Integer#previous and Integer#prev =

https://bugs.ruby-lang.org/issues/17830#change-91726

* Author: rafasoares (Rafael Soares)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
----------------------------------------
I think `Integer#pred` is great as the inverse of `#succ`, but it reads a b=
it weird as the inverse of `#next`, which might be preferable for those goi=
ng for a more "reads like English" approach.

On that note, `#previous` reads better, but it's also twice as long as `#pr=
ed` (or even `#next`). Which is why I've also added the shorthand `#prev`

Since Ruby strives for readability, I always thought it was weird that the =
team omitted this improvement. =


Also, I thought about writing a gem for this, but:
1. Do we really want to add another gem for such a simple change to every p=
roject?
2. Monkey-patching gems feel dirty.

Finally, I want to mention that I tried looking for previous discussions on=
 this topic, as it seems likely someone would've brought this up at some po=
int, but was unsuccessful. Probably due to the massive amount of baggage in=
 the core issue tracker and mailing lists, I could've missed something amon=
g the noise.

I've created a fork on GitHub (https://github.com/rafasoares/ruby/commit/05=
119848b1f480db2e809f964528799030cc7ebb) in order to open a PR, but decided =
to open this ticket as well, after reading the contributing guide more care=
fully. =




-- =

https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=3Dunsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>