https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112016-09-14T21:40:25ZRuby Issue Tracking SystemRuby master - Feature #12746: class Array: alias .prepend to .unshift ?https://bugs.ruby-lang.org/issues/12746?journal_id=605092016-09-14T21:40:25Znrodriguez (Nicolas Rodriguez)
<ul></ul><p>Also <code>.prepend</code> sounds more natural than <code>.unshift</code> (specialy on Array). But it also implies <code>.append</code> which should be aliased to <code>.push</code>.</p>
<p>Example :</p>
<p><code>[1, 2, 3,].append(4).append(5)</code></p> Ruby master - Feature #12746: class Array: alias .prepend to .unshift ?https://bugs.ruby-lang.org/issues/12746?journal_id=616852016-11-25T07:46:40Zmatz (Yukihiro Matsumoto)matz@ruby.or.jp
<ul></ul><p>Accepted.</p>
<p>Matz.</p> Ruby master - Feature #12746: class Array: alias .prepend to .unshift ?https://bugs.ruby-lang.org/issues/12746?journal_id=616872016-11-25T07:51:45Zmatsuda (Akira Matsuda)ronnie@dio.jp
<ul></ul><p>FIY both append and prepend are in ActiveSupport: <a href="https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/array/prepend_and_append.rb" class="external">https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/array/prepend_and_append.rb</a></p> Ruby master - Feature #12746: class Array: alias .prepend to .unshift ?https://bugs.ruby-lang.org/issues/12746?journal_id=640122017-03-31T06:48:22ZJustJosh (Joshua Stowers)
<ul></ul><p>Thanks, Matz! I've been wanting this for a while.<br>
I've just made a PR to the Github repo with the changes: <a href="https://github.com/ruby/ruby/pull/1574" class="external">https://github.com/ruby/ruby/pull/1574</a></p> Ruby master - Feature #12746: class Array: alias .prepend to .unshift ?https://bugs.ruby-lang.org/issues/12746?journal_id=640212017-04-01T07:38:17Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>Applied in changeset trunk|r58227.</p>
<hr>
<p>array.c: Array#append and Array#prepend</p>
<ul>
<li>array.c (Init_Array): Add alias "append" to Array#push, and<br>
"prepend" to Array#unshift. [Feature <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: class Array: alias .prepend to .unshift ? (Closed)" href="https://bugs.ruby-lang.org/issues/12746">#12746</a>] [Fix GH-1574]</li>
</ul>
<p>Author: pascbjumper2 <a href="mailto:stowers.joshua@live.com" class="email">stowers.joshua@live.com</a></p>