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

Namespaces #11

Open
ivanreese opened this issue Apr 29, 2021 · 0 comments
Open

Namespaces #11

ivanreese opened this issue Apr 29, 2021 · 0 comments

Comments

@ivanreese
Copy link
Contributor

We need some way to add support for namespaces, so that two separate scripts in the same JS context can each use Take and Make without collision.

Perhaps the syntax could be:

Make "someNS", "A", A
Take "someNS", ["A", "B"], (A, B)->

Alternatively, maybe we could use proxies?

Make.someNS "A", A
Take.someNS ["A", "B"], (A, B)->

Another consideration is that we might need some way to generate a namespace dynamically, possibly at compile time. For instance, if we used the same namespace in all SVGAs, then we wouldn't be able to load 2 SVGAs into the same JS context without collisions. By compiling each SVGA with a unique auto-generated namespace, we could guarantee that there would be no collisions. We'd probably want to make this opt in on a per Make/Take basis, rather than rewriting plain Take and Make calls so that they had a dynamic NS applied to them. The reason to make it opt-in is so that code inside a dynamic NS could still Take things from a global (plain) NS, for instance if there's a standard library that's loaded into the page once and then shared by all other things loaded onto the same page.

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