Closed emil14 closed 1 year ago
Just forbid array outport indexing and introduce new type of port reference / connection - "array bypass". It must be used when we want to connect some array-outport with some array-inport. Both part of the connection must be array-ports.
Allow only referencing array element if its inport
bypass
connection)Just use List
Just aware programmer that array-outports must be used with caution
Introduce some complicated type system that will be able to figure out complex cases for even operators. Especially it must answer the question - how many port elements this operator will use?
Allow arr-ports and outports to be only 1:1 inports to outports
TODO
If there is a[2]
then there must be a[0]
and a[1]
. Because if there is a[3]
then there is 0,1
elements that must be used because someone is must be sending values to those ports.
n
ports filled but only <n
ports are used outside (could be solved in #54)<n
ports filled but n
ports used #55 Allow outports indexing but make sure any indexing errors will happen at startup of the program
TODO think how to implemnt
Always use all the outports but send some empty values to the ones that are not needed.
Example: p1, p2, p3 -> router -> r1, r2, r3, r4
. There is no value for r4
but router
will send some default value there
Case
For tasks like "subtract numbers from first to last" where:
We need a way to represent ordered variadic arguments
Problem
Imagine some component with an array-outport in a module's network. It's dangerous to refer specific indexes of that outport because we don't know how many indexes will be used inside that component.
Another case is when some module has an array-inport. It's dangerous to refer some specific indexes of that inport because we don't know how many indexes will be used by parent network.
But port reference assumes some index!
Actually these two cases are the same though we talking about outport in the first one and about inport in the second. This happens because for module's network - inport is actually an outport, the port to read from!
UPD: array ports are like variadic arguments / rest in Go/TS. We shouldn't use specific positions
args[2]
from...args
as well as we should't useresults = returnList(); results[2]
. By using onlyargs/results
as is we are safe. This is whatbypass
is!