nevalang / neva

🌊 Flow-based programming language with static types and implicit parallelism. Compiles to native code and Go
https://nevalang.org
MIT License
85 stars 7 forks source link

Match allows array-port overwrite #636

Open dorian3343 opened 1 month ago

dorian3343 commented 1 month ago

You can overwrite a matches array port, which creates an infinite loop. I'd expect for it to throw an error.

Example:

:data -> match:data
'H' -> match:case[0] -> ('Hello, World!' -> println -> :sig)
'Q' -> match:case[0] -> ('Hello, World!' -> println -> :sig)
emil14 commented 1 month ago

I would say that's normal behaviour

You're not "overwriting" you sending to the same inport from several different places i.e. you merge several flows into one

We could in theory ban this for array-inports and say like "unlike regular inport, array-inport slot can only have one source of data" but that could lead to unexpected limitations in the future

I personally would like to see this solved as a special case in linter, when we'll have it