Dynamically loadable language libraries #248
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds ability to load alternative languages via
lang
command. ATM this is a PoC, comments and critique welcome and appreciated, especially on ways to better name and organize things, currently they be clunky.Default behavior of Orca is unchanged. Language implementations can be replaced on the fly with the
lang
command:;
-separated list of namesdefault
clr
is a special name, removes all operator definitionsInternally, the language is a dict of operator definitions, now there are several, placed in
library
directory wherelibrary.js
originally was. For now, only the original (default
) andbase
(not useful by itself but added as a basis for new definitions).New language definition
foo
can be added by defininglibrary.foo
, and then:lang:foo
to loadfoo
operators on top ofdefault
(or currently loaded composite library)lang:clr;foo
to clear definitions and then loadfoo
operatorslang:clr;default
to restore default behavor (with currentdefault
clr
is probably unnecessary unless there were different operators not defined indefault
that needed unloading)Changes:
library.js
tolibrary/default.js
library
changed from an object of operators to object of objects of operators, originallibrary
becamelibrary.default
lang
commandthis.library
attribute toOrca
class, for dynamic overloadingREADME.md