Open zilinc opened 4 years ago
Just a contribution / proposal for an improved surface syntax:
An expression with an "observed variable"
<expr> !v
is difficult to read, because the variable "banging" is at the end and v is always a valid variable from the context. Since <expr>
may be arbitrary large and complex, it may be misleading when you first read <expr>
and only realize afterwards that v has been made readonly. Even in the bilby fs code there are examples where <expr>
has more than one line.
I propose the syntax
let !v in <expr>
instead (or additionally, to be upward compatible). Remarks:
<expr>
the existing variable with the linear value.and
could be applied to support several banged variables and also to mix them with normal bindings, such as in
let a = 10 and !v and !w and b = v.m in ...
let !v in <expr>
would be a special form of the normal let-expression and may be used wherever a let-expression is permitted (or is that a problem for the core syntax?). This would even simplify the syntax (and the parser) by removing the special cases now present for banged variables.
Description
For some reason, we want to rewrite our surface syntax parser, and also take this opportunity to revise our surface syntax.