kellysmith12.21
2020-12-29 07:29:00
I have a question about syntax. In my lang, I’ve tried to reduce the use of parens by using “infix” tokens. A simple example is my syntax for let
: {let a = 1
b = 2
c = 3
#:in (+ a b c)}
Ignoring aesthetics, a real advantage of this is that it helps provide clues when quickly reading/scanning code (e.g. a = 1
has a clear meaning, whereas (a 1)
could mean anything).
So far, I have not used anything but whitespace to delimit such fragments. However, this does mean that single-line code can look a bit funny: {let a = 1 b = 2 c = 3 #:in (+ a b c)}
My question is this: should I permit commas as an optional delimiter, for readability? If I did, then one could write: {let a = 1, b = 2, c = 3 #:in (+ a b c)}
Thoughts?