Issue #14033 has been updated by phluid61 (Matthew Kerwin).


I am opposed to this alias as proposed.

1. `<<` is known to be "dangerous", but other "safe" concatenation operations exist for String (e.g. `+`).  I would expect that a *new* word-based name for the dangerous operation would end with "`!`".

2. `<<` (and `concat`) casts integers as codepoints. `prepend` requires that *all* arguments are Stringy (c.f. `+`).  A method named to be like `prepend`, but that behaves like `concat`, is confusing.

3. `<<` only accepts a single argument, but `concat` accepts many, so this alias would introduce confusion about which method (concat vs. append) has what arity.


If the proposal were about adding [new functionality](https://github.com/phluid61/mug/blob/master/lib/mug/affix.rb) I think it would be worth considering, but I'm against adding a new name for the sake of it.

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

* Author: sos4nt (Stefan Schler)
* 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ˇ˝Concatenates 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>