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

Implement a ShadowRealm API #288

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open

Conversation

ZverGuy
Copy link

@ZverGuy ZverGuy commented May 1, 2023

I implement a shadow realm API from stage 3 proposal
see https://github.com/tc39/proposal-shadowrealm

To add ShadowRealm you need to use AddShadowRealm extension method

изображение

@nilproject
Copy link
Owner

nilproject commented May 2, 2023

As i understand, Realms are not just "a module inside another module". It's looks like GlobalContext, created and managed by script

@ZverGuy
Copy link
Author

ZverGuy commented May 2, 2023

As i understand, Realms are not just "a module inside another module". It's looks like GlobalContext, created and managed by script

maybe you can explain what i need change for correct work? Create a new GlobalContext and bind to module (because importValue require module resolvers for properly module resolving)?

@nilproject
Copy link
Owner

For the first iteration yes, create instance of GlobalContext for Module inside ShadowRealm.
I need to investigate this. It's not looks like easy to implement feature.
Also, spec of this feature is still changing. Maybe, we should to wait when it will be completed

@ZverGuy
Copy link
Author

ZverGuy commented May 2, 2023

For the first iteration yes, create instance of GlobalContext for Module inside ShadowRealm.

I need to investigate this. It's not looks like easy to implement feature.

Also, spec of this feature is still changing. Maybe, we should to wait when it will be completed

Until this feature at Stage 3 - it can be usable by this extension method, i not add this to base library due to possible breaking changes.

@ZverGuy
Copy link
Author

ZverGuy commented May 2, 2023

изображение

Hmm i try to create a new GlobalContext from Shadow Realm constructor and its throw exception

@ZverGuy
Copy link
Author

ZverGuy commented May 13, 2023

изображение
I Fix this issue by some workarounds

@ZverGuy
Copy link
Author

ZverGuy commented May 14, 2023

@nilproject please review

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.

2 participants