https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112013-03-31T10:31:39ZRuby Issue Tracking SystemRuby master - Feature #8190: Truly parallel assignmenthttps://bugs.ruby-lang.org/issues/8190?journal_id=380602013-03-31T10:31:39Zwardrop (Tom Wardrop)tom@tomwardrop.com
<ul></ul><p>=begin<br>
Hmm, yeah that request seems reasonable. Right now it seems to be assigning left-to-right. So (({i})) is assigned (({s[i]})), making (({i})) equal to (({1})), only then is (({s[i]})) evaluated and assigned (({7})) as if it's a separate expression on a new line.</p>
<p>Could be a difficult change to make at least in terms of backwards compatibility, but the suggested behaviour is less surprising than the current behavior in my opinion.<br>
=end</p> Ruby master - Feature #8190: Truly parallel assignmenthttps://bugs.ruby-lang.org/issues/8190?journal_id=381452013-04-03T11:33:04Zmarcandre (Marc-Andre Lafortune)marcandre-ruby-core@marc-andre.ca
<ul><li><strong>Category</strong> set to <i>core</i></li><li><strong>Assignee</strong> set to <i>matz (Yukihiro Matsumoto)</i></li></ul><p>My first reflex would be to say "don't write code like this".</p>
<p>Do you have an actual use case?</p>
<p>FWIW, CoffeeScript handles this case the same way as MRI does.</p> Ruby master - Feature #8190: Truly parallel assignmenthttps://bugs.ruby-lang.org/issues/8190?journal_id=381512013-04-03T14:27:46Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>The evaluation obeys the left-to-right order.<br>
It doesn't seem like a bug to me.</p> Ruby master - Feature #8190: Truly parallel assignmenthttps://bugs.ruby-lang.org/issues/8190?journal_id=381532013-04-03T14:49:51ZHanmac (Hans Mackowiak)hanmac@gmx.de
<ul></ul><p>=begin</p>
<p>((%Lavir_the_Whiolet when you change this you will break code like%))</p>
<p>(({a,b = b,a}))</p>
<p>wich is a feature of ruby</p> Ruby master - Feature #8190: Truly parallel assignmenthttps://bugs.ruby-lang.org/issues/8190?journal_id=381682013-04-03T19:27:12ZAnonymous
<ul></ul><p>I think it's good that Lavir is bringing this up, although I share MA's<br>
feeling. I don't see how his proposal it would break "a, b = b, a". On the<br>
contrary, "a, b = b, a" would only break if the assignment indeed worked<br>
sequentially <em>looks questioningly @ wardrop & nobu</em>. I do not know whether<br>
this slightly counterintuitive behavior is a problem of that requires<br>
change in the code behavior, or just better documentation to remove the<br>
feeling of surprise, but I do not regard design by jury the best approach<br>
in this case.</p> Ruby master - Feature #8190: Truly parallel assignmenthttps://bugs.ruby-lang.org/issues/8190?journal_id=381902013-04-04T06:20:18Zmatz (Yukihiro Matsumoto)matz@ruby.or.jp
<ul><li><strong>Category</strong> deleted (<del><i>core</i></del>)</li><li><strong>Status</strong> changed from <i>Open</i> to <i>Rejected</i></li></ul><p>As Nobu stated the evaluation order goes from left to right.<br>
And if you change this, you will introduce incompatibility.</p>
<p>Matz.</p>