beat-link-trigger icon indicating copy to clipboard operation
beat-link-trigger copied to clipboard

Separate expression namespaces

Open brunchboy opened this issue 6 months ago • 2 comments

Currently all user expressions are compiled in the namespace beat-link-trigger.expressions, which also hosts important plumbing used to compile and manage them. This makes collisions, especially between expressions defined in different shows, likely and dangerous (and is the reason behind the awkward pressure to use only the globals atom for shared storage).

Move the Triggers window expressions to beat-link-trigger.expressions.triggers, which will exist as a just a framework to host them with lots of convenient imports, and real, direct access to a globals atom, but allowing users to define their own vars which need not only be functions.

Move shows expressions into dynamically-created per-show namespaces, e.g. beat-link-trigger.expressions.show-{uuid}, where the UUID is assigned to the show when it is opened. Thus shows will not collide with each other, nor with raw triggers. But this means that raw triggers belonging to shows will need help accessing their shared functions: when compiling them, change show-shared/ to the actual show namespace.

This is a backward incompatible change so it should happen as part of 8.0, and a couple of integration examples that use raw triggers, such as the inbound MIDI example, will need updating.

brunchboy avatar Jun 14 '25 05:06 brunchboy

This will also allow function names in integration example shows to be shortened, since we no longer have to worry about collisions with other shows.

brunchboy avatar Jun 14 '25 05:06 brunchboy

This will also allow triggers and show shared expressions to define other vars, including other atoms, enabling the integration examples to become simpler and more idiomatic Clojure.

brunchboy avatar Jun 14 '25 05:06 brunchboy

This is done, and worked even better than I hoped to simplify the integration examples!

brunchboy avatar Jul 12 '25 01:07 brunchboy