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.
Show HN: A JavaScript function that looks and behaves like a pipe operator
51–60 of 148 posts
Re: Show HN: A JavaScript function that looks and behaves like a pipe operator
#52Earlier 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.
Re: Show HN: A JavaScript function that looks and behaves like a pipe operator
#53The 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.
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 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
#55Earlier 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?
Re: Show HN: A JavaScript function that looks and behaves like a pipe operator
#56https://gcanti.github.io/fp-ts/modules/function.ts.html#pipe
Re: Show HN: A JavaScript function that looks and behaves like a pipe operator
#57Still prefer pipe([ f, g, h, ])(123); Or, you know, a functional language.
Re: Show HN: A JavaScript function that looks and behaves like a pipe operator
#58I 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
Re: Show HN: A JavaScript function that looks and behaves like a pipe operator
#59The 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.
Re: Show HN: A JavaScript function that looks and behaves like a pipe operator
#60The 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.