ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:65714] [ruby-trunk - Bug #10388] [Open] Operator precedence problem in multiple assignment (massign)
       [not found] <redmine.issue-10388.20141015033552@ruby-lang.org>
@ 2014-10-15  3:35 ` knu
  2019-08-20 20:33 ` [ruby-core:94450] [Ruby master Bug#10388] " merch-redmine
  2020-01-16  6:18 ` [ruby-core:96890] " matz
  2 siblings, 0 replies; 3+ messages in thread
From: knu @ 2014-10-15  3:35 UTC (permalink / raw)
  To: ruby-core

Issue #10388 has been reported by Akinori MUSHA.

----------------------------------------
Bug #10388: Operator precedence problem in multiple assignment (massign)
https://bugs.ruby-lang.org/issues/10388

* Author: Akinori MUSHA
* Status: Open
* Priority: Low
* Assignee: Yukihiro Matsumoto
* Category: syntax
* Target version: 
* ruby -v: ruby 2.2.0dev (2014-10-13 trunk 47904) [x86_64-freebsd10]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
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.



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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:94450] [Ruby master Bug#10388] Operator precedence problem in multiple assignment (massign)
       [not found] <redmine.issue-10388.20141015033552@ruby-lang.org>
  2014-10-15  3:35 ` [ruby-core:65714] [ruby-trunk - Bug #10388] [Open] Operator precedence problem in multiple assignment (massign) knu
@ 2019-08-20 20:33 ` merch-redmine
  2020-01-16  6:18 ` [ruby-core:96890] " matz
  2 siblings, 0 replies; 3+ messages in thread
From: merch-redmine @ 2019-08-20 20:33 UTC (permalink / raw)
  To: ruby-core

Issue #10388 has been updated by jeremyevans0 (Jeremy Evans).


I tried working on this a couple weeks ago and I don't believe the current LALR(1) parser can support it.  Attempting to modify the parser to support the behavior you desire leads to many shift/reduce or reduce/reduce conflicts.  It is possible that switching from the default LALR(1) parser to a GLR parser (which bison also supports) may allow for the behavior your desire, but I'm not sure what the ramifications of that are.  It's also possible there is a way to introduce this behavior with the existing LALR(1) parser, and I am just not aware of it, as I do not have much experience in this area.

----------------------------------------
Bug #10388: Operator precedence problem in multiple assignment (massign)
https://bugs.ruby-lang.org/issues/10388#change-80880

* Author: knu (Akinori MUSHA)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
* ruby -v: ruby 2.2.0dev (2014-10-13 trunk 47904) [x86_64-freebsd10]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
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.



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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:96890] [Ruby master Bug#10388] Operator precedence problem in multiple assignment (massign)
       [not found] <redmine.issue-10388.20141015033552@ruby-lang.org>
  2014-10-15  3:35 ` [ruby-core:65714] [ruby-trunk - Bug #10388] [Open] Operator precedence problem in multiple assignment (massign) knu
  2019-08-20 20:33 ` [ruby-core:94450] [Ruby master Bug#10388] " merch-redmine
@ 2020-01-16  6:18 ` matz
  2 siblings, 0 replies; 3+ messages in thread
From: matz @ 2020-01-16  6:18 UTC (permalink / raw)
  To: ruby-core

Issue #10388 has been updated by matz (Yukihiro Matsumoto).


We are not going to change the behavior. We may warn (with `-W`) if we see the simple assignments on the right-hand side of multiple assignments.

Matz.


----------------------------------------
Bug #10388: Operator precedence problem in multiple assignment (massign)
https://bugs.ruby-lang.org/issues/10388#change-83902

* Author: knu (Akinori MUSHA)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
* ruby -v: ruby 2.2.0dev (2014-10-13 trunk 47904) [x86_64-freebsd10]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
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.



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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-16  6:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-10388.20141015033552@ruby-lang.org>
2014-10-15  3:35 ` [ruby-core:65714] [ruby-trunk - Bug #10388] [Open] Operator precedence problem in multiple assignment (massign) knu
2019-08-20 20:33 ` [ruby-core:94450] [Ruby master Bug#10388] " merch-redmine
2020-01-16  6:18 ` [ruby-core:96890] " matz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).