-
-
Notifications
You must be signed in to change notification settings - Fork 230
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
Dynamically loadable language libraries #248
base: main
Are you sure you want to change the base?
Conversation
@@ -70,13 +70,13 @@ To display the list of operators inside of Orca, use `CmdOrCtrl+G`. | |||
|
|||
## MIDI | |||
|
|||
The [MIDI](https://en.wikipedia.org/wiki/MIDI) operator `:` takes up to 5 inputs('channel, 'octave, 'note, velocity, length). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Editor ate trailing spaces, sorry.
<script type="text/javascript" src="scripts/core/library.js"></script> | ||
<script type="text/javascript" src="scripts/core/library/library.js"></script> | ||
<script type="text/javascript" src="scripts/core/library/base.js"></script> | ||
<script type="text/javascript" src="scripts/core/library/default.js"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the uglier parts. Is there a better way to organize and load these so that new definitions can be added without modifying index.html
? Can one JS file import another?
Ideally this would be user loadable.
A way to provide documentation for alternative languages is obviously needed, as well as some additional implementations. The hackability is very well done in Orca, this was a fairly simple change thanks to that. I hope I didn't break that. |
An open question: how to organize files in Because of incrementality language definitions can be as small as a single operator (loaded after
|
Also, "language", "implementation", "spec" and "library" have all been used to name the same thing (a collection of operator definitions comprising the language). What should the canonical name be? |
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