-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Description
Feature Request
- I would like to work on this feature!
Is your feature request related to a problem? Please describe.
The only problem is wanting to land the new "wavy-dot" eventual send syntax (currently stage1) in Babel.
Describe the solution you'd like
Add and implement an ["eventualSend"] parser option.
babel-plugin-syntax-eventual-send and babel-plugin-proposal-eventual-send would be the next steps.
Describe alternatives you've considered
I had a quick hack to get this working (without a clean factoring) in #10115. This current proposal is to implement it the right way according to Babel conventions.
Teachability, Documentation, Adoption, Migration Strategy
Enabling babel-plugin-syntax-eventual-send will enable the "eventualSend" parser plugin. That will emit new nodes in alignment with the proposed syntax:
// foo~.bar
{ type: "EventualMemberExpression", eventual: true, object: foo, property: bar, computed: false }
// foo~.[i]
{ type: "EventualMemberExpression", eventual: true, object: foo, property: i, computed: true }
// foo~.(...args)
{ type: "EventualCallExpression", eventual: true, callee: foo, arguments: args }Secondly, a new babel-plugin-proposal-eventual-send will actually implement EventualCallExpression|EventualMemberExpression in terms of HandledPromise static methods, including the needed pipelining semantics of optimising a member followed by call as a "method", and rewriting ExpressionStatement expressions whose value is discarded as "send-only" methods.
Shout out to: @erights, @FUDCo, @kriskowal.
I'd appreciate feedback from: @loganfsmyth, @jridgewell