Skip to content

Implement a ShadowRealm API#288

Open
kitsunoff wants to merge 2 commits into
nilproject:developfrom
kitsunoff:develop
Open

Implement a ShadowRealm API#288
kitsunoff wants to merge 2 commits into
nilproject:developfrom
kitsunoff:develop

Conversation

@kitsunoff

@kitsunoff kitsunoff commented May 1, 2023

Copy link
Copy Markdown

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

nilproject commented May 2, 2023

Copy link
Copy Markdown
Owner

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

@kitsunoff

Copy link
Copy Markdown
Author

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
Copy Markdown
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

@kitsunoff

Copy link
Copy Markdown
Author

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.

@kitsunoff

Copy link
Copy Markdown
Author

изображение

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

@kitsunoff

Copy link
Copy Markdown
Author

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

@kitsunoff

Copy link
Copy Markdown
Author

@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