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

Possible solution of execution order change #67

Open
Jack-Works opened this issue Sep 24, 2020 · 1 comment
Open

Possible solution of execution order change #67

Jack-Works opened this issue Sep 24, 2020 · 1 comment

Comments

@Jack-Works
Copy link
Member

It must have a new syntax so it can be statically analyzed.

Here is an example (I know it is conflicting with TypeScript syntax though)

declare module "std:Complex" {
    console.log('Polyfilled!')
    if (!BuiltinModule.has(...)) { await fetch('...').then(fill_module) }
}

If std:Complex is never accessed, the code above never being executed.

Once it is accessed, the code above is being executed immediately to prepare the module.

@Jack-Works
Copy link
Member Author

Jack-Works commented Sep 24, 2020

By wrapping all polyfills in the declare statements above, it can resolve the concerns I have mentioned at the meeting, that is, unused partially shimming doesn't cost anything.

This also resolves the execution order problem. No module is more prior that others (the shimming requirement) but it is still polyfillable.

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

No branches or pull requests

1 participant