Dynamically loadable language libraries#248
Dynamically loadable language libraries#248unthingable wants to merge 4 commits intohundredrabbits:mainfrom
Conversation
|
|
||
| ## 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.
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.
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
langcommand. 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
langcommand:;-separated list of namesdefaultclris a special name, removes all operator definitionsInternally, the language is a dict of operator definitions, now there are several, placed in
librarydirectory wherelibrary.jsoriginally was. For now, only the original (default) andbase(not useful by itself but added as a basis for new definitions).New language definition
foocan be added by defininglibrary.foo, and then:lang:footo loadfoooperators on top ofdefault(or currently loaded composite library)lang:clr;footo clear definitions and then loadfoooperatorslang:clr;defaultto restore default behavor (with currentdefaultclris probably unnecessary unless there were different operators not defined indefaultthat needed unloading)Changes:
library.jstolibrary/default.jslibrarychanged from an object of operators to object of objects of operators, originallibrarybecamelibrary.defaultlangcommandthis.libraryattribute toOrcaclass, for dynamic overloadingREADME.md