ServerBoot and ServerTree callbacks ensure SynthDefs and resources load in the correct order after server boot
For a performance piece, you want all SynthDefs added and buffers loaded before any Synths or Patterns are created. SuperCollider provides two callback hooks: ServerBoot.add(func) runs the function each time the server boots, before the tree is instantiated; ServerTree.add(func) runs after the default group is created. Registering piece setup code with these classes ensures correct order regardless of when the server boots. Additionally, s.waitForBoot({ ... }) is an alternate pattern that takes a function to evaluate once the server is ready. Without this sequencing, evaluating SynthDef.add before the server is running, or creating Synths before SynthDefs are added, causes errors.
Examples
ServerBoot.add(~loadBuffers); ServerTree.add(~makeSynthDefs); s.boot;
Alternatively: s.waitForBoot({ SynthDef(\k, {...}).add; });
Assessment
What happens if you call Synth.new(\reverb, [...]) before calling SynthDef.new(\reverb, {...}).add? How do ServerBoot/ServerTree callbacks prevent this problem in a multi-section piece?