I am asking a general question about how the Opusmodus runtime environment is scoping variables, but if it helps:
;;;--------------------------------------------------------
;;; Stage 5. List Processing
;;;--------------------------------------------------------
...
(setf pitches (gen-repeat 5 '((c4 cs4 fs4 g4 c5))))
(setf transposed-pitches (pitch-transpose -24 pitches))
(setf lengths (span pitches '(e)))
(setf lengths-rests (length-weight lengths :weight '(3 1)))
...
My observation is that `pitches`, `transposed-pitches`, `lengths` and `lengths-rests` are now global, once evaluated. If I open an unrelated file, a new file in a new workspace inside of the Opusmodus editor and evaluate:
(princ pitches)
The contents of the "pitches" variable will be printed, although that variable was evaluated in a different file, in a different workspace. This indicates to me that "setf" is creating a dynamically-scoped (global) variable behind the scenes, which is available to all of Opusmodus all at once.
That's fine, of course, but it probably should be documented somewhere. I am coming from a primarily C++ background, some ECMAScript, some Lua, with virtually no Lisp, though, and I was surprised by this scoping behavior. The Common Lisp documentation indicates that calling `setf` without a `let` or a `defvar` is strictly speaking undefined, so if the runtime environment is doing something useful (like creating a global variable), it's important to know that. Because otherwise naive users will reuse variable names and may run into unexpected side effects (and needlessly report bugs as a result )