> While the above pattern has become standardized, it feels somewhat unnatural as we read most of the spoken languages from left to right. Is this true (the 'unnatural' part)? Reading left to right, `age = 42` can be read as "age is 42" which feels perfectly natural in English. `42 => age` would be read as "assign 42 to age"? This feels more awkward to me. I'm not sure I understand why anyone would want Rightward ass…
Ruby adds experimental support for rightward assignments
11–20 of 172 posts
Re: Ruby adds experimental support for rightward assignments
#12Re: Ruby adds experimental support for rightward assignments
#13Eh, there is a reason why Golang has such a huge popularity.
Re: Ruby adds experimental support for rightward assignments
#14Disclaimer: I'm not a core dev but saw a discussion amongst them about such use cases.
Re: Ruby adds experimental support for rightward assignments
#15This hurts readability of code with lengthy expressions. Knowing the target of the assignment is usually more important than the particulars of the expression when you're skimming unfamiliar code. Having the variable pushed out to random locations on a ragged right side isn't helpful.
One of Ruby's philosophies is to provide multiple ways to express the same fundamental operation so that it can conform to your thoughts instead of forcing your thoughts to conform to it. You can still do it the old way where it makes sense. Whether this philosophy is helpful or harmful is another debate.
Re: Ruby adds experimental support for rightward assignments
#16> While the above pattern has become standardized, it feels somewhat unnatural as we read most of the spoken languages from left to right. Is this true (the 'unnatural' part)? Reading left to right, `age = 42` can be read as "age is 42" which feels perfectly natural in English. `42 => age` would be read as "assign 42 to age"? This feels more awkward to me. I'm not sure I understand why anyone would want Rightward ass…
Re: Ruby adds experimental support for rightward assignments
#17I love Ruby and its 10th ways of writing code to achieve same thing... Eh, there is a reason why Golang has such a huge popularity.
Re: Ruby adds experimental support for rightward assignments
#18> While the above pattern has become standardized, it feels somewhat unnatural as we read most of the spoken languages from left to right. Is this true (the 'unnatural' part)? Reading left to right, `age = 42` can be read as "age is 42" which feels perfectly natural in English. `42 => age` would be read as "assign 42 to age"? This feels more awkward to me. I'm not sure I understand why anyone would want Rightward ass…
Re: Ruby adds experimental support for rightward assignments
#19Re: Ruby adds experimental support for rightward assignments
#20Why? Why does ruby have an infinite amount of ways to do the same thing?
I'm not saying it's good or bad, I'm just saying that appears to be one of the reasons for it.