On Thu, 19 Jul 2007, Claude Heiland-Allen wrote:
Again, I tried to create something similar in Pd, but ran into re-entrancy bugs whenever I tried to use recursion. I do not write externals lightly, but in this case I think it was necessary. If someone knows how to solve this in pure Pd, I'd be delighted.
To follow up on our discussion on the FreeNode #dataflow channel... think about what it takes for any object to figure out "hey, I'm being used recursively!". Basically, if I use [+] recursively, there's no way that just by the order of use of the inlets it can figure out whether anything is recursive or not. What it can use is the outlets, but it can only figure out recursion when the left inlet gets stuffed, so if that is preceded immediately by a right inlet message, there's no way for that object to know whether the right inlet message is intended to accompany the recursive call or just configure the object for the benefit of the next non-recursive call. Both possibilities are legitimate uses that have to be supported.
Your only possibility, then, is to make something explicit, with methods "push" and "pop" that can handle backups of states of enough subobjects, or else do something really heavy for creating instances recursively by dynamic patching. (we're at the edge of what makes sense in a pd-style of dataflow... I suppose any solution will look weird)
(In DesireData it could look at pd_stack, but that wouldn't be fast and it's not enough because it still needs a state-preserving system)
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada