Skip to content
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

Update the polyfill to the latest API #71

Merged
merged 4 commits into from
Feb 21, 2024
Merged

Update the polyfill to the latest API #71

merged 4 commits into from
Feb 21, 2024

Conversation

jridgewell
Copy link
Member

No description provided.

@jridgewell jridgewell merged commit dc92ab9 into master Feb 21, 2024
4 checks passed
@jridgewell jridgewell deleted the update-polyfill branch February 21, 2024 04:35
@erights
Copy link

erights commented Feb 27, 2024

Hi @jridgewell @legendecas @littledan ,

How faithful is this polyfill to the proposal? Where does it differ? Does it or could it use the Node async_hooks API to more faithfully emulate the full proposal?

Attn @gibson042

@jridgewell
Copy link
Member Author

The implementation details in src/ aren't from the proposal, it's just a strategy that allows mutating the storage Map directly, and cloning as necessary when we "revert" back to the previous state. So instead of always cloning on enter, it mutates on enter (if the map isn't already frozen) and mutates to exit (if the still isn't frozen).

This also doesn't patch any of the JS standard library, doesn't implement user async/generator functions, etc. Node's async_hooks doesn't capture the generator's init-time context, so we'd have to wrap or transpile generators to get the correct behavior.

@andreubotella has a fork of engine262 that might be up to date (?) if you're looking for appropriate spec implementations. If you're just looking for high level details, the proposal is still basically the same as what we discussed last year, just with an updated public API. The internal implementation is still a Map or LinkedList depending on how the engines want to optimize.

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