This one of my very old ideas and goes all the way back to InfoLabVIEW. I recently got reminded in this thread to write it up as an idea. You might have heard it before. If not, read it :D)
Currently, an output tunnel gets the default value for the given datatype if "use default if unwired" is enabled and a case executes where it is not wired. Recently, we also got the "linked tunnels" feature, which is more like an editing assistant.
Many times we have a big stack of cases but the computation of many outputs is shared by many cases, maybe with one or two notable exceptions. 😉 It would be cool to be able to define this shared "default" code only once so it is executed unless we create an exception case.
My suggestion is to have a new, special case that allows us to define the output of each tunnel for cases where it does not receive an overwriting input.
The image shows a few possibilities for an event structure (same applies for all other relevant structures).
A: A reference is wired across by default. We don't need to wire across any other case.
B: Nothing is defined, so it acts like today. This is the default, so everything is automatically backwards compatible with existing code.
C: A number is incremented with each iteration unless we overwrite in a specific case
D: The default output is based on the operations of several inputs.
E: If a tunnels is unwired, we get NaN (or whatever we need) instead of zero. For I32 me might want -1, for example.
F: Same as A. This is similar (but not exactly the same) as linked tunnels. (I.e. It also applies to existing unwired cases)
G: This tunnel is defined in all cases. If we add an unwired case later it would act like B.
H: (not shown): certain global event terminals (e.g. time) should also be available in the "default definition case", because we might want to utilize it for a default output.
Downconversion would be somewhat messy. It would probably need to wire the relevant default operations into all cases where an output is not wired, keeping the functionalty the same.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.