tc39 / proposal-pipeline-operator

A proposal for adding a useful pipe operator to JavaScript.
http://tc39.github.io/proposal-pipeline-operator/
BSD 3-Clause "New" or "Revised" License
7.52k stars 108 forks source link

Need examples of Ramda/RxJS/etc. usage of Hack pipes #218

Open js-choi opened 3 years ago

js-choi commented 3 years ago

The explainer currently has examples from Ramda’s source code, but it doesn’t have examples from libraries that use Ramda, RxJS, or other libraries that are designed for curried tacit programming (see #217 and https://github.com/tc39/proposal-pipeline-operator/issues/202#issuecomment-919374937).

The only reason why I didn’t add examples from the most popular libraries that depend on Ramda RxJS, etc. is because—although I know of a few somewhat popular libraries that depend on them—I don’t know what the most popular libraries that relies on them are. (NPM’s website doesn’t let you sort packages that depend on a specific package by popularity.) So I mean to write a little script that lets me do that later, find out what the most popular libraries that depend on Ramda or RxJS are, and then extract examples from them to the explainer. [Edit: Looks like NPM does now roughly sort dependent packages by popularity (or maybe it always has? maybe I’m crazy and it was always like this). So, we can get going on looking at their codebases, hooray.]

(To emphasize, it is likely than an attempt to switch from Hack pipes to F# pipes will result in TC39 never agreeing to any pipes at all; syntax for partial function application (PFA) is similarly facing an uphill battle in TC39 (see HISTORY.md). I personally think this is unfortunate, and I am willing to fight again for F# pipes and PFA syntax, later—see https://github.com/tc39/proposal-pipeline-operator/issues/202#issuecomment-919374937. But there are quite a few representatives (including browser-engine implementers; see HISTORY.md about this again) outside of the Pipe Champion Group who are against improving tacit programming (and PFA syntax) in general, regardless of Hack pipes.)

In any case, the explainer has real-world examples taken from Ramda, but it does not have real-world examples taken from libraries that use Ramda (or RxJS). This is a deficiency of the explainer. We need to fix this sometime.

This issue tracks the fixing of this deficiency in the explainer (lack of examples from libraries that use Ramda or RxJS). Please try to keep the issue on topic (e.g., comments about these libraries working better with F# pipes would be off topic), and please try to follow the code of conduct (and report violations of others’ conduct that violates it to tc39-conduct-reports@googlegroups.com). Please also try to read CONTRIBUTING.md and How to Give Helpful Feedback. Thank you!

lozandier commented 3 years ago

@benlesh has provided some examples; he may be willing to work specifically with you on this towards the end you're talking about regarding you being willing to fight again for F# pipes and the non-far-fetched sentiment that pipeline operator is too ubiquitous with functional composition to be represented by the hack-style as-is.

ken-okabe commented 3 years ago

@lozandier Unfortunately not. He announced he will never corporate with the current Hack proposal and ignore it.

https://github.com/tc39/proposal-pipeline-operator/issues/228#issuecomment-925465598

benlesh commented 3 years ago

Please don't answer for me. Honestly, you've been in a lot of these threads, and I would almost consider what's going on trolling, at least in tone Even though I know you favor the same proposal I do, I don't think you're helping. If this were my repository you might have lost your privileges.

With regards to adding my two cents about which of the proposals I think would be most beneficial for functional programming use cases in this language, I feel I've said all I can say. Unfortunately, the direction that the proposal is going isn't particularly useful to the community I serve.

Unrelated, if somebody on this committee needs examples of how functions are piped in RxJS, regardless of the reason, I am happy to provide whatever information they need. In fact, if anyone on this committee needs anything related to RxJS, I think I'm pretty easy to find, and I consider it my duty to perform such tasks on behalf of the RxJS community.

On a personal level though, I would like to stay out of any heated debates.

js-choi commented 3 years ago

@benlesh: Hey, I appreciate your offer very much. (There are in fact several other early proposals that I, maybe in a few months, would love to have assistance with regards to RxJS’s real-world use cases. These include a resurrected infix bind operator, an F#-style computation-expressions system for monadic/applicative comprehensions, hopefully PFA syntax, and possibly a resurrected |>> F#-style tacit function application operator after Hack pipes. I’ll ping you later about those other proposals when they’ve ripened more.)

When it comes to this particular proposal, I would be quite interested in figuring out what are the most-popular, highest-impact open-source projects/libraries that use RxJS. I was planning on writing a script that queried for the most-downloaded RxJS-dependent libraries from NPM, but your expertise would also be invaluable here.

benlesh commented 3 years ago

highest-impact open-source projects/libraries that use RxJS.

The most obvious ones are angular related: @angular/router, etc. inquirer is also a big one. But there are a ton of semi-popular one-off libraries. The easiest way to get a list is here: https://www.npmjs.com/browse/depended/rxjs

js-choi commented 3 years ago

Yes, I only wish https://www.npmjs.com/browse/depended/rxjs could be sorted by popularity! 😅 [Edit: Wait…are they already sorted by popularity? That’s different than I remember! Now I won’t have to write that script, hooray.]

Anyways, I figured @angular/router and inquirer would be big ones, and it’s good to know that this is actually true. I’ll search their codebases later for examples potentially amenable to Hack pipes. Thanks again for your help here. (I’ll ping you about help with the other proposals’ impact on RxJS later.)

benlesh commented 3 years ago

@js-choi You might want to look at https://github.com/ReactiveX/IxJS as well. This is sort of... "RxJS only for AsyncIterables" very similar, just a different set of use cases.