io7m-com / cedarbridge

Cedarbridge message protocol specification language
https://www.io7m.com/software/cedarbridge
ISC License
0 stars 0 forks source link

Redesign how protocols are declared #21

Closed io7m closed 2 years ago

io7m commented 2 years ago

Right now, creating a new version of a protocol involves re-declaring all of the messages again:

[record A]
[record B]
[record C]
[record D]

[protocol D
  [version 1 A B C]
  [version 2 A B C D]
  [version 3 B C D]
]

When the number of messages is large, this is unwieldy. It might be better to introduce the concept of protocol expressions that are evaluated to yield a final protocol. Nothing needs to change with regards to type checking, code generation, or otherwise.

[record A]
[record B]
[record C]
[record D]

[protocol D
  [version 1
    [introduce A]
    [introduce B]
    [introduce C]
  ]
  [version 2
    [introduce D]
  ]
  [version 3
    [remove A]
  ]
]