@gavalakis, I dove deep into how to make the coroutines work and it is NOT as easy as I described in my post above (of course).
But, what would help, is for example having a flow maintain its own context.
This is most obvious with the ForEach example. Where with coroutines you get a wrong element.
I am not sure how to do this but this is the code from For each
`
foreach ( var o in li ) {
if ( broken ) {
break;
}
currentObject = o;
currentIndex++;
fCurrent.Call(f); // <- this is the issue
}
As you see, if the body of the flow is a coroutine it is working with incorrect data context as underlying variables change.
Thus “naively” it should be called with something like:
fCurrent.Call(f.Clone())
Where “Clone()” would create its own variable context for all output values of this node (i.e. keeping the value of “Current” in the ForEach bound to this branch of execution). The other options (less complicated I believe) would be:
fCurrent.Call(f, f.outputMap);
Thus the Call method will obtain outputMap which holds output values that will be fed into output ports.
This would allow for MUCH more dynamic programming.
Login
Register
By registering on this website you agree to our Privacy Policy.