nevalang / neva

🌊 Flow-based 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

Improve struct field selectors syntax #653

Open emil14 opened 1 month ago

emil14 commented 1 month ago

Change Existing Syntax (Sender Side)

Before

foo:bar.baz.bax -> ...

After

foo:bar -> .baz.bax -> ...

Implementation Details

  1. Remove selectors from SenderSide
  2. Add new type of SenderSide - StructFieldSelector
  3. Rewrite how analyzer and desugarer handles this. It's now should be part of the chained connection (always, connection cannot start from selector)

Add New Syntaxes

Chained Connections Inside Multiple Receivers

xxx -> [
  foo -> bar,
  baz -> bax
]

Should be desugared as

xxx -> [foo, baz]
foo -> bar
baz -> bax

Struct Selectors As Chained Connections In Multiple Receivers

Finally implement this

xxx -> [
  .foo -> bar
  .baz -> bax
]

This is continue of https://github.com/nevalang/neva/issues/594