nevalang / neva

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

Default values for inports (default arguments) #564

Open emil14 opened 6 months ago

emil14 commented 6 months ago

If flow has len(inports) > 1, then all inports could have default values.

flow Foo(a int = 1, b string = "a", c bool = true) (res stream<string>)

Default values are always optional, it'c completely ok not to have them. Even more than that, this should not be used much because there's a downside of this.

Removing default value breaks backward compatibility

However, parent always forced to use at least one (except special cases like New that doesn't have inports) port of a child node even if all ports have default values.

Implementation

Could be implemented as a syntax sugar of constants.

emil14 commented 6 months ago

We should also be able to refer constants probably from signature then

emil14 commented 6 months ago

Idea - all inports can have default values but at least one inport must be used

emil14 commented 6 months ago

Minor but not because the impact (is big) but because we don't have a lot of problems with (without) it RN