[#78633] ruby/spec needs help from CRuby committers — Benoit Daloze <eregontp@...>
Currently, ruby/spec is maintained mostly by individuals and enjoys the
13 messages
2016/12/13
[#78642] Re: ruby/spec needs help from CRuby committers
— Eric Wong <normalperson@...>
2016/12/14
Benoit Daloze <eregontp@gmail.com> wrote:
[#78963] Re: ruby/spec needs help from CRuby committers
— Urabe Shyouhei <shyouhei@...>
2017/01/04
I did ask attendees of last developer meeting to join this
[#79029] Re: ruby/spec needs help from CRuby committers
— Benoit Daloze <eregontp@...>
2017/01/09
Thank you Shyouhei-san for your reply.
[ruby-core:78860] [Ruby trunk Bug#12860] Splatting an argument does not obey left-to-right execution order
From:
usa@...
Date:
2016-12-27 09:34:43 UTC
List:
ruby-core #78860
Issue #12860 has been updated by Usaku NAKAMURA. Backport changed from 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED to 2.1: REQUIRED, 2.2: DONE, 2.3: REQUIRED ruby_2_2 r57210 merged revision(s) 56469. ---------------------------------------- Bug #12860: Splatting an argument does not obey left-to-right execution order https://bugs.ruby-lang.org/issues/12860#change-62268 * Author: Charles Nutter * Status: Closed * Priority: Normal * Assignee: * Target version: * ruby -v: 2.3.1 * Backport: 2.1: REQUIRED, 2.2: DONE, 2.3: REQUIRED ---------------------------------------- Ruby evaluates arguments left to right, but it does not appear to handle construction of the eventual argument list from left to right. Take this example: ```ruby def foo(*args) p args end ary = [1,2] foo(*ary, ary.shift) ``` With left-to-right execution, the `ary` value should be splatted (1, 2), and THEN shifted (1) producing `args == [1, 2, 1]`. However, on MRI, the shift occurs *before* the splat, so `args == [2, 1]`. This is counter-intuitive. At the moment in time the splat is encountered, `ary` is still `[1, 2]`. So the first two arguments should be (1, 2). THEN the shift happens, producing a third argument of (1). This affects JRuby running Rails because they have a small piece of code that depends on this unusual behavior: https://github.com/rails/rails/blob/master/activesupport/lib/active_support/callbacks.rb#L411-L425 This code appears to have been introduced into Rails recently, and I will file a separate issue to change it to be more explicit about ordering. -- 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>