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

Hello,

9 messages 2017/10/04

[ruby-core:83401] [Ruby trunk Feature#14033] Alias String#<< as String#append

From: shevegen@...
Date: 2017-10-19 21:39:07 UTC
List: ruby-core #83401
Issue #14033 has been updated by shevegen (Robert A. Heiler).


I +1 agree with Stefan for symmetry. :)

However had, I may be biased since I discussed in favour of the
Array-methods .prepend() and .append().

But I suppose the reasoning is very similar. I think that both class
String and class Array could share the same method .prepend and
.append here, from a functional point of view. The ruby user may
want to put something on the "beginning" of the array - and the
ruby user may put something on the "end" of the array. Same for
a string (if we assume that the entity of a string are
characters).

The .prepend() method may be more useful for Strings; for append()-like
operations, I personally  always prefer <<. I do not know why, I just
love <<.

I think the major point I agree with it is that it, to me, appears
to make sense from an english language point of view. A short
"action-method" name - prepend this, append that. It would make 
sense in my opinion to have .append for strings too, but I may be
biased so perhaps others can comment.

----------------------------------------
Feature #14033: Alias String#<< as String#append
https://bugs.ruby-lang.org/issues/14033#change-67365

* Author: sos4nt (Stefan Schテシテ殕er)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
Ruby 2.5 introduces `Array#append` as an alias for `<<` / `push`.

Likewise, there should be `String#append` as an alias for `<<` / `concat`. The documentation for `<<` even says "append":

> Append窶任oncatenates the given object to str. [...]

And `String` already has a `prepend` method.



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

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

In This Thread

Prev Next