@oid said:
@ddw_music In pd there is no instruction pointer so never any need to return or backtrack or goto.
You absolutely must backtrack in the case of any object that has multiple outputs. Backtracking is most straightforwardly done with a stack.
A stack is only a data structure that defines two operations: add something new at the end (push) and take the last item off of the end (pop) -- last in, first out. "Stack" doesn't define what it should be used for. It may be data, as in FORTH; it may be execution frames; can be anything.
If necessary, I could find it in the source code later, but let's assume that Miller Puckette is no fool, and he knows that tree traversal is best done with a stack, and that he isn't going to waste time trying to implement some alternative to a stack because of a preconception that stacks are for x or y but never z (and further, that he wouldn't post "stack overflow" errors to the console if that was misleading).
I am not quite sure how it deals with reaching the end of the branch...
I'm also not sure of the implementation details in C (don't really need to be), but if each object gets pushed onto a message-passing stack, then it's easy: when this object is done, pop an object off the stack and see if it has outputs that haven't been issued yet; then issue them, or if there are none, pop again and repeat until the stack is empty. Because a stack is LIFO, this is always (literally!) backtracking.
If you've ever used Max's graphical debug mode: it literally shows you the message-passing stack in a window. I'll admit that I don't have the line-number evidence to show exactly how pd does it in C, but I'm not making this up...
Trigger is unused at run time, it's only used at "flatten" time... However audio tree is flatten to create a DSP chain but maybe the control tree is not…
I'm quite sure there's no flattening for control objects. (See Max's debugger, or I bet pd's trace mode will show the same.)
Edit:

trace: bang
trigger: bang -- not flattened
message: One
print: One
trigger: bang -- and, after doing "One," it backtracked to here
message: Two
print: Two
backtrace: -- what happened before the [trace] object?
bng: bang
Note that you don't know "what happened before the [trace] object" without a stack 
Again, if I'm really saying anything controversial, when time permits I can go diving into pd's sources and find the evidence. But IMO the [trace] output is enough.
hjh