nevalang / neva

🌊 Dataflow programming language with static types and implicit parallelism. Compiles to machine code and Go
https://nevalang.org
MIT License
128 stars 8 forks source link

Support binary and ternary expressions inside chained connections #774

Open emil14 opened 5 days ago

emil14 commented 5 days ago

Problem

We still have to use deferred connections to trigger binary and ternary expressions

:start -> { (1 + 2) -> println -> :stop }

Proposal

Support binary and ternary expressions inside chained connections

:start -> (1 + 2) -> println -> :stop

Similar to #772 there will be 2 implementations - one for outside of chain (existing one) and the other for chains.

Questions to Answer

  1. Are we going to implement same way as Range/New? For them it might be ok to have 2 versions, but is it ok for all the binary operators? Are we going to have 2 versions for each?
  2. Are we going to implement it through locks? Won't it be too unobvious/implicit having that we have deferred connections? Isn't it too much special cases? Won't it damage language design?

Related to #741

emil14 commented 3 days ago

I definitely do not want it be desugared like deferred connections - by using locks. We'll end up having 2 different ways of doing exactly the same thing - defer receiving of a binary expression.

In cases with const refs/lits and ranges there was a difference in semantics - chained connection version was working differently and in a more performant way, so it was clear why use should do that, whenever possible. Here, however, it might lead to questions (why do they even have this more verbose syntax for the same thing?)