Skip to content

Add ability to evaluate a value as a PlatformScript module.#29

Merged
cowboyd merged 1 commit intomainfrom
cl/module-eval
Dec 6, 2022
Merged

Add ability to evaluate a value as a PlatformScript module.#29
cowboyd merged 1 commit intomainfrom
cl/module-eval

Conversation

@cowboyd
Copy link
Copy Markdown
Member

@cowboyd cowboyd commented Dec 6, 2022

Motivation

Sometimes we want to be able to treat a snippet of code as a fully formed module that can depend on other modules and define symbols.

There is a bit of a risk in the sense of what do you do if you have two different virtual modules that have the same URL? This should probably be an error.

Approach

This adds a moduleEval operation to PlatformScript to treat any PlatformScript value as a module.

Alternate Designs

We can in the future just make $import a function that is defined everywhere and the result is that it just returns a module. This can be explored later.

Sometimes we want to be able to treat a snippet of code as a fully
formed module that can depend on other modules and define symbols.

There is a bit of a risk in the sense of what do you do if you have
two different virtual modules that have the same URL? This should
probably be an error.
@taras taras self-requested a review December 6, 2022 18:27
Copy link
Copy Markdown
Member

@taras taras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@cowboyd cowboyd merged commit a9b3dbe into main Dec 6, 2022
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