Skip to content

add partial-application - #334

Merged
nzakas merged 4 commits into
estree:masterfrom
JLHwung:partial-application
Mar 2, 2026
Merged

nzakas merged 4 commits into
estree:masterfrom
JLHwung:partial-application

Conversation

@JLHwung

@JLHwung JLHwung commented Jan 20, 2026

Copy link
Copy Markdown
Contributor

View Rendered Text

This PR adds Partial Application support. It is based on Babel's current approach, which implements a legacy version of this proposal prior to October 2021.

@michaelficarra

Copy link
Copy Markdown
Member

I don't like this. Partial applications are not like variants of call/new expressions. They're unrelated other than they have similar surface syntax. Partial call/new should be their own nodes.

@JLHwung

JLHwung commented Jan 30, 2026

Copy link
Copy Markdown
Contributor Author

I don't like this. Partial applications are not like variants of call/new expressions. They're unrelated other than they have similar surface syntax. Partial call/new should be their own nodes.

Thank you for your suggestion. Like I said the current AST design reflects on Babel's current approach, implemented long ago when the proposal only contains the argument placeholder. Another reason for partial: boolean is that ESTree models ?.() as

ChainExpression > CallExpression { optional: true }

I am fine with new nodes because of the ~ prefix requires certain marker on the call/new expression. Either a boolean property or a new node type can serve for such purpose. I will revise the AST draft.

Aside: As a known deviation from ESTree, Babel models ?.() as an OptionalCallExpression node, so I am looking for naming suggestions for the ?.~() production, do you think OptionalPartialCallExpression is fine? or PartialOptionalCallExpression?

@JLHwung

JLHwung commented Jan 30, 2026

Copy link
Copy Markdown
Contributor Author

@michaelficarra Updated the AST draft, PTAL.

Comment thread experimental/partial-application.md Resolved
@michaelficarra

Copy link
Copy Markdown
Member

Yes this seems better. Thank you.

I am looking for naming suggestions

I have no opinions on naming.

@JLHwung

JLHwung commented Feb 25, 2026

Copy link
Copy Markdown
Contributor Author

@nzakas ping. Any review comments? Thank you.

@nzakas nzakas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the revised approach. LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants