nevalang / neva

🌊 Dataflow 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

[Syntax]: Add `->` to component signature (like in Rust) #606

Closed emil14 closed 1 month ago

emil14 commented 1 month ago

Before

component Main(start) (stop) {
    nodes { Match<int>, next PrintNext2Lines }
    :start -> (99 -> next -> match:data)
    -1 -> match:case[0] -> :stop
    match:else -> next
}

component PrintNext2Lines(n int) (n int) {
    nodes {
        decr Decr<int>
        first PrintFirstLine
        second PrintSecondLine
    }
    :n -> first -> decr -> second -> :n
}

After

component Main(start) -> (stop) {
    nodes { Match<int>, next PrintNext2Lines }
    :start -> (99 -> next -> match:data)
    -1 -> match:case[0] -> :stop
    match:else -> next
}

component PrintNext2Lines(n int) -> (n int) {
    nodes {
        decr Decr<int>
        first PrintFirstLine
        second PrintSecondLine
    }
    :n -> first -> decr -> second -> :n
}
Catya3 commented 1 month ago

It kind of flows... I do like it. Seems worth the extra bytes.

emil14 commented 1 month ago

Today @Catya3 and I discussed this and here's what we think

Even though it makes sense, it's just gonna be a lot of arrows