Project

General

Profile

Actions

Bug #10388

closed

Operator precedence problem in multiple assignment (massign)

Added by knu (Akinori MUSHA) about 10 years ago. Updated almost 5 years ago.

Status:
Rejected
Target version:
-
ruby -v:
ruby 2.2.0dev (2014-10-13 trunk 47904) [x86_64-freebsd10]
[ruby-core:65714]

Description

I understand it wouldn't be easy to fix this, but since I happened to find it here it goes.

  • a, b = c = 1, 2 is currently taken as a, b = (c = 1), 2; I'd expect it to be taken as a, b = (c = 1, 2).

  • a, b = *c = 1, 2 is currently taken as a, b = *(c = 1), 2; I'd expect it to be taken as a, b = *(c = 1, 2) or even a, b = (*c = 1, 2).

  • a, b = c, d = 1, 2 is currently taken as a, b = (c), (d = 1), 2; I'd expect it to be taken as a, b = (c, d = 1, 2).

Should they be fixed/changed or not, issuing a warning would be greatly helpful.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0