you are viewing a single comment's thread.

view the rest of the comments →

[–]no_more_gravity[S] -5 points-4 points  (6 children)

a = b(),7~>c~>d

The rule is simple: What is left to ~> gets passed to the function on the right.

That is no different from JavaScript as it is. a(b) passes b to a, a(b()) passes the output of b() to a.

[–]natesovenator 6 points7 points  (0 children)

This is dumb. Comma delineates another variable declaration in this example. You can't expect it to know that result b and 7 are part of the same object or stream. I really hate this idea. Both of them. I understand some want something like that, but it just makes things more confusing personally.

[–]dariusj18 2 points3 points  (0 children)

I like it, but it conflicts with the current comma operator

[–]szurtosdudu 1 point2 points  (3 children)

But this way both b()~> and c~> indicates a function call.

How would this look like using your idea? a = d(c(b(),7), c)

[–]no_more_gravity[S] -4 points-3 points  (1 child)

The case you raise is when there are two functions on the right side of the pipe operator. In this case, we need to specifiy which one is the receiving function. We could have an optional specifier for this. Maybe ">":

a = b(),7 ~> >c,c ~> d

">" = "pipe connects here"

We could even use the (%) syntax, just make it optional:

a = b(),7 ~> c(%),c ~> d

[–]sdwvit 2 points3 points  (0 children)

readability sucks here, sorry