Alternative `nodes` syntax
Opened this issue · 1 comments
emil14 commented
Replace nodes{}
with node ...
just like we did when we removed group form in #601
It will save as 2 lines and 1 nesting level, but will allow to mix nodes and connections (could be handled by formatter/linter)
Before
component Main(start) (stop) {
nodes {
r1 Range, r1 Range
Product<int, int>,
For<ProductRes<int, int>>{Println<ProductRes<int, int>>}
}
:start -> [
(0 -> [r1:from, r2:from]),
(3 -> [r1:to, r2:to])
]
r1 -> product:first
r2 -> product:second
product -> for -> :stop
}
After
component Main(start) (stop) {
node r1 Range, r2 Range
node Product<int, int>
node For<ProductRes<int, int>>{Println<ProductRes<int, int>>}
:start -> [
(0 -> [r1:from, r2:from]),
(3 -> [r1:to, r2:to])
]
r1 -> product:first
r2 -> product:second
product -> for -> :stop
}
Downside
It would be impossible to reuse this syntax recursevely for DI
emil14 commented
With comp
instead of component
comp Main(start) (stop) {
node r1 Range, r2 Range
node Product<int, int>
node For<ProductRes<int, int>>{Println<ProductRes<int, int>>}
:start -> [
(0 -> [r1:from, r2:from]),
(3 -> [r1:to, r2:to])
]
r1 -> product:first
r2 -> product:second
product -> for -> :stop
}