home/ atoms/ p5live-sandbox-region-pairing

P5LIVE sandbox and strudel regions must use matched open/close comment delimiters at top level, not inside functions

P5LIVE uses paired comment delimiters to demarcate embedded Hydra (// sandbox … // sandbox) and Strudel (// strudel … // strudel) regions. An unmatched or mistyped delimiter causes one of two failures: the embedded code never evaluates (silent failure), or the content is swept into the p5 recompile, triggering hardCompiles on every Hydra keystroke — which defeats the purpose of the sandbox. Regions must be placed at the top level of the file, not nested inside setup() or draw(). This pairing rule is structural: the parser treats everything between matching delimiters as belonging to a different runtime.

Examples

Correct: // sandbox\nosc(40,0.1).out()\n// sandbox at file top level. Wrong: placing the sandbox block inside function draw() {}.

Assessment

Given a P5LIVE file that triggers a full hardCompile every time a Hydra parameter is tweaked, diagnose the most likely structural cause and show the fix.

“An unmatched or mistyped delimiter means the code either never evals (silent) or gets swept into the p5 recompile (triggering hardCompiles on every Hydra keystroke”
context/ · L1-instruments/p5live/gotchas.md · chunk 1