Issue #10450 has been updated by bug hit.


Yusuke Endoh wrote:
> I think that the restriction is no longer meaningful, but it does not mean that this is a bug.  Whatever the reason is, the behavior has been the spec.  It is not harmful.  It is trivial to work around.  So I consider this ticket as a feature request.
> 
> I can reopen this ticket, but it has many noises and too long.  I also recommend you to open a new ticket to feature request tracker.
> 
> Note that a feature request proposer has a duty to persuade matz.  You must give a clear, short, and attractive explanation.  You should not assume that he could read the whole explanation.  He has no time.  At worst, he may skip any English sentences and read only the first example.  So, you should choose the best example carefully.

If you can reopen, then please do, I think it's better not to have two tickets for the same issue.  I disagree that this is a feature.  Recursive composablility of expressions is and should be the rule.  It is the exceptions to this rule that require justification.  Back when multiple assignment was always truthy, the exception was justified, now it's not, making the current behavior unjustified, illogical, arbitrary, i.e a bug.
 

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

* 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/