Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Multiple assignment expression as return value: `true` in rbx, `Array` in MRI #1955

Closed
alindeman opened this Issue Oct 15, 2012 · 2 comments

Comments

Projects
None yet
3 participants
Contributor

alindeman commented Oct 15, 2012

rubinius 2.0.0dev (1.8.7 2279857 yyyy-mm-dd JI) [x86_64-apple-darwin12.2.0]

rbx-head :017 > def foo; a, b = 1, 2; end;
rbx-head :018 >   foo
 => true

MRI both 1.8.7 and 1.9.3 differ:

1.8.7 :001 > def foo; a, b = 1, 2; end;
1.8.7 :002 >   foo
 => [1, 2]
1.9.3p286 :001 > def foo; a, b, = 1, 2; end;
1.9.3p286 :002 >   foo
 => [1, 2]
Contributor

headius commented Oct 15, 2012

Surprising...I thought rbx fixed this in response to a bug at some point...

See also this bug I filed with MRI...I don't believe the return value is useful enough (or often enough) to warrant creating a whole array whenever multiple assignment is used as an expression: https://bugs.ruby-lang.org/issues/6668

Owner

brixen commented Oct 22, 2012

Duplicates #1765.

@brixen brixen closed this Oct 22, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment