Live data from Hacker News

Ruby adds experimental support for Rightward assignments

blog.saeloun.com

21–30 of 39 posts

Re: Ruby adds experimental support for Rightward assignments

#21

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.

I don't even care about the verbosity - it's just ugly syntax. If I'm skimming a file that uses that syntax, I could easily get confused and think there's a comparison going on. One of Ruby's big draws (to me, at least) is code that is incredibly expressive and code that is aesthetically pleasing to look at. I feel this is serving the expressiveness at huge cost to aesthetics, and honestly there's not much gain to expressiveness in my opinion.

EDIT: I also completely forgot about the existing hashrocket syntax for maps.

Re: Ruby adds experimental support for Rightward assignments

#24
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.

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 ":=".

Re: Ruby adds experimental support for Rightward assignments

#25
post #24

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. On an unrelated side note, I've always thought "=" was a huge mistake in language design, confusing countless people who are com…

> 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 ":=".

Probably because adding a colon to an equality sign doesn’t clarify the meaning at all.

Had Algol (as some less widely influential for other reasons languages have) adopted something that more clearly represented movement into the variable being assigned like:

  a 
Maybe it would have won out over “=" for assignment.

Re: Ruby adds experimental support for Rightward assignments

#27
post #24

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. On an unrelated side note, I've always thought "=" was a huge mistake in language design, confusing countless people who are com…

> 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 ":=". Probably because adding a colon to an equality sign doesn’t clarify the meaning at all. Had Algol (as some less widely influential for other reasons languages have) adopted something…

I considered such an assignment operator for a little language I was developing, but there was an ambiguity between this:

  a 
and this:

  a 
Since everything was an expression in the language, the latter would evaluate to a boolean. In the end I just went with "=" for assignment, and "==" for equality.

Re: Ruby adds experimental support for Rightward assignments

#28

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.

I don't particularly like the idea of rightward assignment (although the syntax itself seems fine to me), but the "million-and-one ways to do everything" is the biggest reason I strongly prefer the language over more "constrained/limited" languages like Python. In those terms, this seems like a definite win for the language (and those who choose to use it) for me.

Re: Ruby adds experimental support for Rightward assignments

#29
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.

I'd wonder how the right assignment would work differently. What small gotcha would it create.

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.

For me. having a million ways to do something leads to slower dev time. More context I'd need to load.

Re: Ruby adds experimental support for Rightward assignments

#30
post #4

I’m a fan. In my limited experience, leftward assignment breaks the “flow” explaining a program to a novice.

The problem is.. most popular languages use leftward assignment. Teaching a noob this would make other languages harder to read. I can switch from Java, to c++ to ruby.. My 9 year old figured out the leftward assignment. It feels like a change for change sake.
Post reply on HN