To me this seems like a clear loss. The syntax is (as far as I can tell) strictly more verbose than the existing assignment syntax. Ruby is already plagued by a million-and-one ways to do everything, but at least in other cases simplicity (à la zen of Python) trades off for brevity.
Another language that supported this was Northern Telecom's PROTEL (<a href="https://en.wikipedia.org/wiki/Protel" rel="nofollow">https://en.wikipedia.org/wiki/Protel</a>) from the 1980s.<p>The operator is written "->" and is informally called a "gazinta" ("goes into").
A better example IMO is...<p>Before:<p><pre><code> result = case value
when 5
...
when 4
...
end
</code></pre>
After:<p><pre><code> case value
when 5
...
when 4
...
end => result
</code></pre>
The latter allows for some nicer formatting I think.
Does sort of make a hash in Ruby more confusing to the untrained eye (unless the hash rocket is totally dead, I haven't written Ruby since like the 2.3 days):<p>{ "age" => age, "name" => name }<p>I like the <i>idea</i> a lot. It'd probably allow for some nice functional <i>looking</i> code, but that's also the problem... it'd only <i>look</i> functional. And I think without VM/compiler/runtime support of functional programming it's pretty much a big waste of time.<p>I can use piece shit for a shoehorn; doesn't mean I should.
Doesn't this introduce an ambiguity?<p><pre><code> def foo(*arg, **kwarg)
puts "#{arg}/#{kwarg}"
end
b = 'meh'
foo(:a => b)
</code></pre>
Now this produces<p><pre><code> []/{:a=>"meh"}
</code></pre>
But with right-assign<p><pre><code> [:a]/{}
?</code></pre>
For simple one-line expressions, this doesn't seem to offer much. However, looking at multiline statements with FP-style or conditional logic, this can definitely improve the flow and visual rhythm of the code.
Why do most languages use right-to-left assignments? Is it purely a matter of path dependence? I guess also that binding a value to a name usually indicates that you'll use the name later on, and having the name on the LHS makes for a better UI for looking up the value the name is bound to.<p>On an unrelated side note, I've always thought "=" was a huge mistake in language design, confusing countless people who are coming into programming who reasonably mistake it for equality. I don't know why it won over ALGOL-style ":=".
This is so ugly.
Already we have things like AND vs &&
or tailing if's that don't quite work like three line if's
or how scoping do..end vs {} is ever so slightly different.<p>I'd wonder how the right assignment would work differently. What small gotcha would it create.<p>I also wonder how my co-workers would take it, if I started using it.. Or if I figured out how it was different and used it for the once case that it worked.<p>For me. having a million ways to do something leads to slower dev time. More context I'd need to load.
In a totally different context (but with same semantics), it's known as the ChucK operator, or "chucking".<p><a href="https://chuck.cs.princeton.edu/doc/language/oper.html" rel="nofollow">https://chuck.cs.princeton.edu/doc/language/oper.html</a>
Is there a place we can voice our concerns over this move.<p>I was just teaching Ruby to someone learning to code. I have to admit because all popular languages use leftward assignment it was one less thing to teach.<p>=> is pretty loaded as it is