Skip to content

using namespace should support dynamic namespaces #1133

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

Open
Tracked by #1132
StartAutomating opened this issue Jun 27, 2024 · 0 comments
Open
Tracked by #1132

using namespace should support dynamic namespaces #1133

StartAutomating opened this issue Jun 27, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@StartAutomating
Copy link
Owner

StartAutomating commented Jun 27, 2024

Useful syntax

using namespace https://x/y/z # is valid syntax
# so is:
using namespace @'
ghcr.io/startautomating/pipescript
'@
# so is:
using namespace anynamespacethatdoesnotexist
# or
using namespace language.javascript

By using syntax like this, we can describe as dynamic of a namespace as we'd like.

Additionally, since dynamic namespaces are simply dynamic objects, they can dynamically describe a "use"

For example, we could "use" a container registry as a base image to run code in a container.

We could also simply "use" any language object to attempt to run or translate the script (that would be up to each language to decide).

Architecture

Using one or more dynamic namespaces should be fairly straightforward.

Let us imagine our using namespace statements, and the namespace keyword, as a stack of namespaces.

If any of the stack items are defined and have a .Use method, that will be called with the ScriptBlock as input.

Any output will be passed to the next defined .Use for a namespace.

If the output from the entire chain is a [ScriptBlock], and the file is a template, it will be the output of the template.

Using Languages

Since anything can become a namespace, all languages will be considered namespaces.

Thus, if a language defines a .Use, and it is in the stack, it will be used.

Using Protocols

Since anything can become a namespace, all protocols will be considered namespaces.

Thus, if a protocol defines a .Use, and it is in the stack, it will be used.

@StartAutomating StartAutomating self-assigned this Jun 27, 2024
@StartAutomating StartAutomating added the enhancement New feature or request label Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant