[#47409] [ruby-trunk - Feature #6973][Open] Add an #integral? method to Numeric to test for whole-number values — "regularfry (Alex Young)" <alex@...>

12 messages 2012/09/03

[#47481] [ruby-trunk - Bug #7008][Open] rake is crashing when trying to compile ffi gem — "drookie (Eugene M. Zheganin Eugene M. Zheganin)" <eugene@...>

10 messages 2012/09/12

[#47505] [ruby-trunk - Feature #7019][Open] allow `private` and `protected` keywords to take blocks — "alexeymuranov (Alexey Muranov)" <redmine@...>

15 messages 2012/09/13

[#47582] [ruby-trunk - Bug #7037][Open] float formatting inconsistently rounds half to even — "headius (Charles Nutter)" <headius@...>

14 messages 2012/09/19

[#47638] [ruby-trunk - Bug #7046][Open] ERB#run and ERB#result are not safe for concurrent use — "headius (Charles Nutter)" <headius@...>

11 messages 2012/09/21

[#47655] [ruby-trunk - Feature #7051][Open] Extend caller_locations API to include klass and bindings. Allow caller_locations as a method hanging off Thread. — "sam.saffron (Sam Saffron)" <sam.saffron@...>

13 messages 2012/09/23

[#47657] [ruby-trunk - Feature #7055][Open] Allow `.foo=` as a synonym of `self.foo=` — "alexeymuranov (Alexey Muranov)" <redmine@...>

11 messages 2012/09/23

[#47730] [ruby-trunk - Bug #7085][Open] Subversion → GitHub gateway stops. — "shyouhei (Shyouhei Urabe)" <shyouhei@...>

27 messages 2012/09/29

[#47735] [ruby-trunk - Bug #7087][Open] ::ConditionVariable#wait does not work with Monitor because Monitor#sleep does not exist — "rklemme (Robert Klemme)" <shortcutter@...>

10 messages 2012/09/29

[#47759] [ruby-trunk - Bug #7092][Open] StringScanner start-of-line matches false positives, while lookbehind for a newline gives false negatives — "jayferd (Jay Adkisson)" <jjmadkisson@...>

8 messages 2012/09/30

[ruby-core:47609] Re: [ruby-trunk - Feature #6668] Multiple assignment should not return an Array object

From: Charles Oliver Nutter <headius@...>
Date: 2012-09-20 01:26:48 UTC
List: ruby-core #47609
On Wed, Sep 19, 2012 at 3:38 AM, SASADA Koichi <ko1@atdot.net> wrote:
> FYI, from 1.9 the Array for RHS is not generated if it is not needed.
>
> # not generated
> a, b = c, d
> a, b, c = d, e

system ~/projects/jruby $ ruby-1.9.3 -e "def foo(c, d); a, b = c, d;
end; p foo 1, 2"
[1, 2]

system ~/projects/jruby $ ruby-1.9.3 -e "def foo(d, e); a, b, c = d,
e; end; p foo 1, 2"
[1, 2]

Perhaps by not needed you mean "not used in an expression"?

> # generated
> a = b, c
> a = b, c, d
>
> I remain the spec because of compatibility.
> #=> go to matz issue.
>
> As you say the case which need to generate an array are not major case,
> it is not performance problem in my opinion.

I disagree. For example, the following case would make instance
variable initialization much cheaper if the array did not have to be
constructed:

def initialize(a, b, c)
  @a, @b, @c = a, b, c
end

As above, since this line is the return value from the method, an
array would be created that nobody ever uses. There are many similar
cases where multiple assignment just happens to be the last line of a
method but nobody cares about the Array result...so it is wasted
effort to create it.

- Charlie

In This Thread