Ruby 2.7 has added the pipeline operator ( |> ), but not in the way many Rubyists had expected.
The merge can be found here.
Update:
Matz has...
For further actions, you may consider blocking this person and/or reporting abuse
Overall a pretty informative post. However I would like to add that:
Could also be written as:
I have never seen this kind of ruby before. That's very interesting.
The reason you might not have seen it. Is because the composition operators (
>>
and<<
) are introduced in Ruby 2.6.0 and are still fairly new.I love Ruby, it's the first programming language I ever learned (with Rails), but that is a toneless and disturbing response. Despite using Ruby for a few years now, I had no idea the project was "owned" by Matz. This is a huge blow for my love of the language :'(
I would say this is not a very charitable view of Matz's comment, and it would be wise to remember that English is not his first language. Perhaps we should ask for clarification on what he means by this before jumping to conclusions.
On the face of it, yours seems like a very charitable response. But I see you've met him before so point taken.
Some of this could just be a shattering of the rose-tinted view I've (possibly mistakenly) held of the Ruby language.
It sounds like you've already had a more grounded understanding of Ruby's development process:
That's not the community driven process I had imagined. This doesn't help.
Exactly. People love taking things out of context too.
You can see this on reddit, where people keep on claiming "omg omg omg this is not following the principle of least surprise". It seems no matter how often I correct these statements, people do not listen and will repeat these erroneous statements. It is as if some do not want to learn, so they have a closed mind.
I don't see a problem here. Matz created ruby. And it is not as if matz is not listening to feedback either - see the issue tracker.
People who dislike something will always be super-vocal about something, and often use their EMOTION first. You can see it with the numbered parameters where people write terrible claims such as "this makes my code be like perl" or "this leads to sloppy programming". I refuted these statements but it does not change the fact that people are not objective - they are emotional and will make their statements based on emotions.
Language design has to be about making decisions. You can always reason based on objective statements, but not on emotions. And I write this while also saying that I think oldschool ruby is better than modern ruby, even though I write a lot more ruby code these days. Ruby 1.8.x was the best ruby IMO.
I think Matz is forcing the community's hand on this to create a discussion. A little counter intuitive maybe but it's working ;-)
I don't understand the point of the current implementation but if it becomes a way to move from LHS to RHS like in the JS and Elixir examples... I'd be okay with it.
You pick a single example and discount other examples.
I already refuted this in issue trackers, so I will refute it here too, just so that people don't singularize on these erroneous claims made by people who write clearly in the sense of how they dislike something.
Consider:
In the middle of writing code, you add:
pp dog
pp some_strange_name_here
And in these examples, it is so much easier to write:
pp @4
pp @5
Since you decided to focus on only a trivial example, I am happy to extend your example with another one.
I am getting hugely tired of people being so single-minded.
It is totally fine to dislike a change; for example, I don't like the |> pipe operator and will not use it. But I do not think it is good to be critical AND only mention what you dislike, without finding ALL possible advantages/disadvantages.
I am writing lots of ruby and while I dislike some of the changes,
it is not as if you are forced to use any of it. Nor would this
affect the way I write code either. I am just selective in what I
use and what I don't use.
I find it strange of you to consider wanting to use ruby or not based on new features. That is already a HORRIBLE use case if you don't use the language as-is. None of the changes made me stop writing ruby code altogether - I just don't use the changes I dislike. Are you FORCED to use anything that is added?
There is only one thing I agree with - the explanation part, which is often missing or incomplete. I think it is fine to make changes; sompe people will always dislike something. It is still important to explain, in english, what is added, why and so forth - otherwise the language is a black box. Discussions at the ruby dev meeting are also summarized in english, which is good - this should be for all changes that are discussed in japanese too, because many people do not understand japanese. I don't for instance, so I depend on english.
I'll point out the obvious, you can't refute an opinion. You've just presented a counter-opinion.
The pipe operator should support a FP approach to development where the dot syntax supports an OOP approach:
Should call the method bar/2 on the object returned
from the function foo/0
foo().bar(1, 2)
Should pass the object returned by function foo/0
as the first param on the function bar/3
foo() |> bar(1, 2)
Since when is taking a one easy to type character and making it two annoying to type characters "syntactic sugar" 🤔