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

[Idea]: Allow interfaces with one in/outport without port name #604

Open emil14 opened 1 month ago

emil14 commented 1 month ago

In this case we don't care about the port names. It could make sense to allow any component where count ports and their type matches to implement this interface

IHandler(any) (any)

...

... -> iHandler -> ...
Catya3 commented 1 month ago

Is it possible to analyze code without port names currently or would this be a new mode of analysis?

emil14 commented 1 month ago

I just figured out that this could only be possible for interfaces. Components must always provide some port names even if there's 1 in/outport. The reason is that we need to somehow refer to our own ports in the network.

Ofc it could be possible to have empty strings as port names and refer to them like :->: but looks weird. Feels safer to avoid this.

emil14 commented 1 month ago

Is it possible to analyze code without port names currently or would this be a new mode of analysis?

Analyzer will need some fixes if we will allow this but it's not rocket science :)

emil14 commented 1 month ago

That could even be a enforced rule not to have port names for interfaces with one port on a side, that makes easier to implement that interface and makes code harder to broke after renaming stuff