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

Question about "Namespace" #286

Closed
Jack-Works opened this issue Nov 17, 2020 · 3 comments
Closed

Question about "Namespace" #286

Jack-Works opened this issue Nov 17, 2020 · 3 comments

Comments

@Jack-Works
Copy link
Member

IIRC in the old design realm.import(str) returns a { module: Namespace } to prevent auto-unpacking of thenable object in Promise. It seems like this behavior is removed in the current spec. Is it no longer to be considered to be a problem?

export function then() {
    console.log('oops')
}
@kriskowal
Copy link
Member

Related tc39/proposal-compartments#29

We have informal consensus among Compartments champions that we can and should make import consistent with dynamic import per the principle of least surprise. The hazard exists. Dynamic import is unfixable. Better in this case to be consistent.

The Compartment proposal has a synchronous module method that is not vulnerable to the thenable module hazard and can be used in concert with import to avoid the problem.

@littledan
Copy link
Member

Yes, I agree with Realms following the same design, to just return a Promise of the module namespace object.

@Jack-Works
Copy link
Member Author

That answer my question thanks

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

3 participants