@oid said:
Edit2: I guess wires are also gotos then.
I realized a bit later what the difference is -- In Pd, wires are procedure calls, not gotos.
Continuing the tangent, feel free to disregard 
Pascal distinguishes between procedures and functions, where a function has a return value and a procedure does not. (C gets rid of the term "procedure," but you can still have void
functions.) In SmallTalk (and SC inherits this), there is always a return value, which may be ignored -- hence no such thing as a procedure. The last thing a function or method does is to return a result and drop its own execution frame off the stack. In rand(20) * 2
, after rand
returns the random number, there is only the result -- the fact that rand
was called at all is forgotten. (Returning from a procedure just drops the execution frame, with no return value.)
In dataflow, there are only procedures and the last thing an object does is to procedure-call the next object -- the entire history stays on the stack. In [random 20] --> [* 2] --> [print]
, "random" is more like: 1. Get from the RNG; 2. Call descendants with this result; 3. Then backtrack up the stack.
It's kind of like, Random(20, descendants: [Multiply(_, 2, descendants: [Print(_)])])
. I could hypothetically create these objects in SC and it would work (but, not much point lol).
The two approaches are mirror images: lisp would write (print (* (random 20) 2))
where the last operation to be performed ("print") is at the head of the tree. Structurally SC is the same. Syntactically it may be different, since a method selector may be either pre- or post-fixed, but (rand(20) * 2).postln
still parses as follows. Then it renders bytecodes depth first! So internally it ends up like FORTH ("push 20, random, push 2, *
, postln").
postln
|
*
/ \
rand 2
|
20
But in Pd, the last operation is structurally the innermost leaf, not the head.
I think this explains a bit why it took me a good couple of years to wrap my head around dataflow, even though (I thought) I knew a thing or two. It's literally upside-down world for me. Still struggle with that sometimes.
hjh