Live data from Hacker News

Show HN: A JavaScript function that looks and behaves like a pipe operator

github.com

51–60 of 148 posts

Re: Show HN: A JavaScript function that looks and behaves like a pipe operator

#51

Earlier quoted context omitted.

If you read all the text, it seems like the entire repo is intended to be a satire on https://github.com/tc39/proposal-pipeline-operator .

Unfortunately I’m not getting satire vibes from that blurb. I’m only more scared for JavaScript. I love JavaScript but this pipe thing is horrific.

Tell that to Unix/FP lovers.

Re: Show HN: A JavaScript function that looks and behaves like a pipe operator

#52
post #40

Earlier quoted context omitted.

But at what cost? You had to name two intermediate variables - and naming things is hard.

In this case the variable is the documentation of the code. You don't have to write something like "this is the message", you can see it.

What if it isn't a message? What if "msg" is already used for another variable?

Re: Show HN: A JavaScript function that looks and behaves like a pipe operator

#53

The following example code is a bit hard to read: const { status } = await send(capitalize(greeting) + "!") console.log(status) I disagree, I find this example code very easy to read because it reads like idiomatic Javascript. Unlike this library.

The strength of the pipeline operators comes when you have to do method chaining things like:

  const foo = capitalize(underline(reverse(exclaim(indent(value)))));
I already forgot the amount of parentheses I needed to close with while typing that.

Re: Show HN: A JavaScript function that looks and behaves like a pipe operator

#54
This is cool, I love JS syntax hacks. Well done!

  const { status } = await send(capitalize(greeting) + "!")
  console.log(status)
I find that easy to read, and your pipe operator harder (but still sensible!). I guess that just reflects the backgrounds we come from, people from more functional backgrounds (maybe lisp or Haskell) will find the latter example easier I guess!

Re: Show HN: A JavaScript function that looks and behaves like a pipe operator

#55
post #40

Earlier quoted context omitted.

In this case the variable is the documentation of the code. You don't have to write something like "this is the message", you can see it.

What if it isn't a message? What if "msg" is already used for another variable?

This is some wonderful performance art you’re doing here

Re: Show HN: A JavaScript function that looks and behaves like a pipe operator

#58

I mean, if you abuse formatting enough I suppose... although I will say, the pipeline/bind operator has been in proposal for a decade at this point.. it's depressing that some version hasn't shipped, because C# extensions and similar in swift can really help shift how from what.. it* could really help JavaScript a lot

The JS proposal is very dubious imho, I'm really not fond of the direction they want to take the pipe operator.

Re: Show HN: A JavaScript function that looks and behaves like a pipe operator

#59

The following example code is a bit hard to read: const { status } = await send(capitalize(greeting) + "!") console.log(status) I disagree, I find this example code very easy to read because it reads like idiomatic Javascript. Unlike this library.

It's funny that their example is much harder to read

Re: Show HN: A JavaScript function that looks and behaves like a pipe operator

#60

The following example code is a bit hard to read: const { status } = await send(capitalize(greeting) + "!") console.log(status) I disagree, I find this example code very easy to read because it reads like idiomatic Javascript. Unlike this library.

The strength of the pipeline operators comes when you have to do method chaining things like: const foo = capitalize(underline(reverse(exclaim(indent(value))))); I already forgot the amount of parentheses I needed to close with while typing that.

No worries your ide will help you for the parentheses.
Post reply on HN