You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Do allows you to run a Wire without having to schedule it on a Mesh. This is useful when you wish to reuse a Wire multiple times, similar to a function.
However, contrary to expectation, calling (Do wire-name) from different wires may result in unexpected behaviour because wire-name will only have a reference to the context of the first parent wire that called (Do wire-name). This might be problematic in the case that a wire wants to reference variables from multiple different caller wires, but can only reference variables from the first wire that calls it.
Example of possible unexpected behaviour:
If (Do caller-1) is called followed by (Do caller-2), then wire-name will always assign 10 to the .parent-variable in caller-1 without being able to reference the .parent-variable in caller-2. If this is a non-issue, then the documentation should be updated as the explanation could be misleading regarding reusability of wires in this way.
(defwire wire-name
10 > .parent-variable)
(defwire caller-1
0 >= .parent-variable
(Do wire-name))
(defwire caller-2
0 >= .parent-variable
(Do wire-name))
The text was updated successfully, but these errors were encountered:
According to the documentation on shards flow,
However, contrary to expectation, calling
(Do wire-name)
from different wires may result in unexpected behaviour becausewire-name
will only have a reference to the context of the first parent wire that called(Do wire-name)
. This might be problematic in the case that a wire wants to reference variables from multiple different caller wires, but can only reference variables from the first wire that calls it.Example of possible unexpected behaviour:
If
(Do caller-1)
is called followed by(Do caller-2)
, thenwire-name
will always assign 10 to the.parent-variable
incaller-1
without being able to reference the.parent-variable
incaller-2
. If this is a non-issue, then the documentation should be updated as the explanation could be misleading regarding reusability of wires in this way.The text was updated successfully, but these errors were encountered: