Issue #15799 has been updated by shevegen (Robert A. Heiler).


> I think there is nothing wrong with having parentheses for Range, I
> think they actually help readability.

My comment is not meant in regards to the example given for Range, but
more in general. I am not sure if having mandatory parentheses is a
(visual/syntactic) improvement. Python folks often claim this, while
forgetting that you can easily use () in ruby. I myself like to avoid
(), but I never avoid them when I do "def foobar(a, b, c)". This is
often just to satisfy the expectation that I have when looking at 
ruby code; my brain works easier/faster for method definitions
having (). I don't have any particularly strong preference for ()
elsewhere, though.

There is one slight problem in regards to syntax diversification in
general - it can make the code that ruby users write difficult for
others to read.

You mentioned Haskell lateron, and I remember an older discussion
on #gobolinux with a hacker from denmark (oejet) who was using 
Haskell. Back then he stated that writing haskell is quite easy for
him, but reading haskell is quite difficult.

While ruby is, in my opinion, much easier than haskell, I think 
adding syntax flexibility, while this in itself is not necessarily
bad, and it may add new feature to ruby, it makes it hard(er) to 
work with code written by other people. Of course it may be great
for individual freedom, but for larger projects I think this may
be somewhat ... hmm, more difficult. I myself would not be able
to adjust to projects that would use features that I do not use
in my own code base. (Although I also tend to avoid looking at
ruby code written by other people these days, because there is so
much terrible code out there ... I am sure others may say this 
about my own code bases too ;)).

> Martin's desugared version which works today is actually shorter and
> I believe most would agree it's also clearer.

Yes - I have this often with some other changes too. Oldschool ruby
beats many newer additions (syntax-wise; I don't think people have
much against features/functionality per se, but I myself think that
syntax is hugely important too. Otherwise we could use languages
with a terrible syntax.)

Note that I do not have a huge preference in this regard though. I
slightly dislike |> but not so much because of the syntax, more
that to me it feels as if it came from elixir and people who are
in favour of the syntax seem to be elixir-users who cross language
ideas. It is not even against ruby's "philosophy" per se, since 
matz always tried to make it convenient for people to use ruby
(e. g. collect versus map, people use whichever variant they prefer),
but I still don't feel it is necessarily a great idea to adopt 
syntax that works very well in other languages. My opinion is that
this often just does not work well in e. g. ruby.

People seem to base their reasoning largely on their own personal
preferences primarily; I guess one can say the same about people
disliking any feature/change, too. :)

> To be fair, I don't particularly like Haskell code and find it
> very cryptic, which this is getting closer to.

Oddly enough, I actually felt that Haskell has a fairly clean
syntax. What I dislike about Haskell is the complexity. I don't
want to think when I code (yes, I am not the thinker; I am more
a random tinkerer; I probe/change at code until it works and
does what I want it to do, hopefully).

> Also, if we actually introduce a pipeline operator, I think
> it's much more useful to have Elixir semantics of passing
> the result as the first argument of the RHS, than just a
> different syntax for ..

Hah! I actually thought that was elixir. :) Now your comment
is more similar to Haskell (I don't quite know haskell very
well; nor elixir either).

But otherwise I agree - I think oldschool ruby is clearer. 
Still, having said that, what matz once wrote somewhat applies
to this here too - you don't have to use it if you dislike
it. I do this with a lot of ruby, e. g. I only use a subset
of ruby, and I quite happily ignore the rest. :P

I guess perhaps there should be more examples given. Right now
only nobu gave an example here and I think it would be more 
fair if others e. g. in particular during rubykaigi but also
on the bug tracker, show more examples for the pipeline 
operator/idea (I don't know what was discussing during ruby
kaigi of course; I guess some other folks may also not know
that either).

----------------------------------------
Feature #15799: pipeline operator
https://bugs.ruby-lang.org/issues/15799#change-77792

* Author: nobu (Nobuyoshi Nakada)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
Implemented the pipeline operator `|>`, a topic of "ruby committers vs the world" in RubyKaigi 2019.
Also a casual idea of rightward assignment.

```ruby
1.. |> take 10 |> map {|x| x*2} |> (x)
p x #=> [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
```

https://github.com/nobu/ruby/tree/feature/pipeline




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>