nevalang / neva

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

[Idea]: Partial structural matching #609

Closed Catya3 closed 2 months ago

Catya3 commented 4 months ago

In a structural type system I should expect to use Match<stream<int>> to do this:

... -> match:data // pass stream to data
{last: true} -> match:case[0] -> :stop

That is it should match on the partial contents of the struct. What I actually got is:

{"data": 50, "idx": 0, "last": true} panic: runtime error: comparing uncomparable type runtime.MapMsg

emil14 commented 4 months ago

Seems like both Eq (if we gonna have one) and Match should implement this

emil14 commented 4 months ago

@Catya3 is this how Rust works?

{last: true} -> match:case[0] -> :stop
emil14 commented 4 months ago

@Catya3 do we need this issue if we have https://github.com/nevalang/neva/issues/613 ?

Is this issue about something else except structures? Is (partial) pattern matching working in e.g. Rust for smt else?

Catya3 commented 4 months ago

No I think this can be closed