Issue #10450 has been updated by Alex Boyd.


Ah, historical holdover... Those are fun. :-)

That being the case, any chance of getting my patch applied?

Martin Drst wrote:
> Bugs have to be rejected if there's a valid reason for rejection, even ifanother reason also was given that may or may not be valid.
> 
> Maybe if you can show how to implement what you want (i.e. how to get around the LALR limitation), then you can open another issue.

To clarify bug hit's point, the LALR limitation was only one facet of this ticket. The other one was permitting multiple assignment *with* the requisite use of parentheses, which the parser is perfectly capable of but which was being filtered out by hand in `assign_in_cond` due to what Yusuke Endoh explained was historical behavior that no longer exists. The patch I included in my comment would be sufficient to lift this restriction.

----------------------------------------
Bug #10450: multiple assignment in conditional
https://bugs.ruby-lang.org/issues/10450#change-50434

* Author: bug hit
* Status: Rejected
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
* ruby -v: ruby 2.1.4p265 (2014-10-27 revision 48166) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
multiple assignment is an expression whose value can be truthy (array) or falsy (nil, false), so why is there a restriction on its use in conditionals?  A warning perhaps is justified, but a syntax error, why?


irb(main):001:0> if a, b = nil then 1 else 0 end
SyntaxError: (irb):1: syntax error, unexpected ',', expecting keyword_then or ';' or '\n'
if a, b = nil then 1 else 0 end
     ^
(irb):1: syntax error, unexpected keyword_then, expecting end-of-input
if a, b = nil then 1 else 0 end
                  ^
	from /home/alex/.rbenv/versions/2.1.4/bin/irb:11:in `<main>'
irb(main):002:0> if (a, b = nil) then 1 else 0 end
SyntaxError: (irb):2: multiple assignment in conditional
	from /home/alex/.rbenv/versions/2.1.4/bin/irb:11:in `<main>'
irb(main):003:0> (a, b = nil) ? 1 : 0
SyntaxError: (irb):3: multiple assignment in conditional
	from /home/alex/.rbenv/versions/2.1.4/bin/irb:11:in `<main>'
irb(main):004:0> (a, b = nil)
=> nil




-- 
https://bugs.ruby-lang.org/