Reply To: Understanding Call (new Flow(1)) vs Call(f)

FlowCanvas Forums Support Understanding Call (new Flow(1)) vs Call(f) Reply To: Understanding Call (new Flow(1)) vs Call(f)

#1469
Gavalakis
Keymaster

Hey,

That is an interesting question.

The general idea, is that a new Flow should be used when conceptually the node is meant to signal the start of a new flow in the graph, while the existing received Flow should be used, when conceptually the node is continuing on a previously started flow signal.

Thus, a new Flow should be created by Event nodes, since event nodes are the ones that signal a new flow traveling in the graph, while in all other cases where is possible and an existing Flow is already received, that same Flow instance received should also be further passed down to the next node called, by doing “Call(f);”

Architecture wise, this way we can for example tell how many “ticks” a single flow signal has done from start to finish (event node to final destination node). We can also pass temporary parameters that live within the Flow instance down the “flow pipe” which we can set or get using the “Read/Write Flow Parameter” nodes, and which can prove useful is some advanced situations. There are also some other features planned, which will require this architecture to be followed by all nodes created.

The value given in the constructor (the 1), is a legacy/deprecated feature that is no longer used or needed and serves purpose no longer, thus the value you provide in the constructor, is currently irrelevant. This is why I suggest that to avoid confusion and for your convenience, to use “Flow.New()” instead of “new Flow(1)” (which is basically a shortcut).

To recap:
– Whenever an existing Flow instance is received, you should use that received instance in your next call down the pipe if possible ( Call(f) ).
– If no Flow instance is received, thus it is the start of a new flow signal, then of course a “new Flow()” should be created and used, which is basically the case for all Event nodes.

Please let me know if that helps, or if you need any further information.
Thanks!

(PS: I am planning to make a sticky post with the planned features sometime within the week 😉 )

Join us on Discord: https://discord.gg/97q2Rjh