[#83107] Alias Enumerable#include? to Enumerable#includes? — Alberto Almagro <albertoalmagro@...>

Hello,

9 messages 2017/10/04

[ruby-core:83149] Re: Alias Enumerable#include? to Enumerable#includes?

From: Eric Wong <normalperson@...>
Date: 2017-10-06 07:04:34 UTC
List: ruby-core #83149
Alberto Almagro <[email protected]> wrote:
> this was mentioned at Euruko's conference by Bozhidar Batsov and fully
> resonated with my own personal experience using Ruby. As I tweeted after
> the conference I would like to contribute to make Ruby better, and
> aliasing Enumerable#include? with Enumerable#includes? would be a great
> start. I simply can't remember how many times I have written includes?
> instead of include? Last Saturday I definitely confirmed that I'm not the
> only one. What do you think?

Having multiple names for the same thing increases learning,
review, optimization, and implementation costs.  IMHO, Ruby
already has too many aliases which make things more difficult
than they should be; we should not add more aliases.


Furthermore, there are many classes outside Enumerable with
"include?" which would also need "includes?" for consistency if
your change were accepted.  This also applies to 3rd-party
libraries like Rack and Rails which subclass core Ruby classes
or define workalike "include?" methods for databases or
case-insensitive hashes.

Introducing a second name would be harmful to polymorphic use.

If Ruby were a brand new language with no baggage, we may only
have "includes?" instead.  But Ruby has tons of outside
dependencies which already rely on "include?" for several
decades, now.


A similar example: *nix has a similar problem with "creat" and
"O_CREAT".  Introducing "create" and "O_CREATE" as aliases at
this point would only harm compatibility, portability, and
reviewability.

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread