New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add hack style pipeline proposal #11600
Conversation
More examples please. |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit da02613:
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/45126/ |
@aadamsx sorry, what do you mean by more examples? This PR includes a full test suite. What other kind of example would you like to see? |
To clarify: Hack is Smart without "bare style"? |
According to the linked issue, it seems that hack doesn't use |
@tabatkins - RE: tc39/proposal-pipeline-operator#167 (comment) Do you plan to talk about this during the June meeting? I tried looking for slides or examples in the agenda but I couldn't find them. |
@mAAdhaTTah correct, this is like the "smart" proposal but without supporting "bare" calls. @nicolo-ribaudo |
Talking with the other pipeline champions, we'll be targetting the July meeting for pipeline discussions. |
There’s now a formal Hack-pipes proposal, which is replacing the now-withdrawn smart-mix pipes proposal. The next steps are:
I’ve been talking with @xixixao, @mAAdhaTTah, and @tabatkins about this. We’ll work on this when we can. |
Thanks! |
In preparation for upcoming renaming commit. Titles are now already arguably more readable.
Titles are now much more readable.
Unwrap and remove the PipelineBody, PipelineBareFunctionBody, PipelineBareConstructorBody, PipelineBareAwaitedFunctionBody, PipelineTopicBody, and PipelineStyle types.
The “primary” part was a vestige of the old smart-mix pipeline proposal.
Updated to @js-choi 's new version of this PR. |
Thanks, @xixixao. The current code now should have no conflicts with Babel upstream. In addition, the obsolete smart-mix plugin mode has been removed. ASTs also have been simplified; they just use Before this gets merged, I think it would be a good idea to change the Hack plugin mode to require that a topic token be specified in its configuration, with no default token. (The default topic token is currently To that end, I’m working on adding support for specifying the topic token right now, after which I’ll work on supporting I’m working on these changes in my own fork at https://github.com/js-choi/babel/tree/proposal-hack-pipes. |
Can we keep adding the hack proposal and removing the smart one in separate PRs? We cannot remove the smart proposal until the next major, but the hack proposal can be implemented in a minor. |
Alright, noted; I’ll add smart-mix mode back in a future commit. |
Superceded by #13191 |
This addresses the discussion starting at tc39/proposal-pipeline-operator#167 (comment).
It adds the Hack-style only pipeline proposal. It's a strict version of the smart proposal, it's simpler, and I hope it has a better chance to go through the proposal process.
Even if this isn't your favorite version, or you don't believe this is the right path forward, surely we can agree it would be good to level the playing field to have this proposal implemented in Babel.
Implementation details
I dropped the indirect eval. I don't see a reason to special eval for pipelines, the point of this proposal is that it is extremely simple and interacts well with existing code. Therefore this code:
should work just as well as
Tests
I converted the "bare" test to an error test (the other proposals are unfortunately missing tests for errors, so the coverage there isn't great).
I changed the eval test to test the "direct" eval.