3 ms·
It makes closures relatively clean, since the syntax is usable directly as an initializer for constants. var f = {arg body } const main =
by ori_b 11y ago
It makes closures relatively clean, since the syntax is usable directly as an initializer for constants.
var f = {arg
body
}
const main = {
g({arg; body})
}
- akavi 11y agoYay! I have an irrational love of this sort of thing; I enjoy the reinforcement of the idea that functions are just another kind of value. It seems like there really aren't that many languages with this symmetry (most lisps, JS/CS, Haskell, ...?), which I find a little strange.
- voaie 11y agoSo a semicolon plays three roles in the code (arg; statement; block;;), and it seems that ;; has higher precedence when ;;; is seen.
- ori_b 11y agoSort of. Endlines have one role: They end statements, although there are potentially many kinds of statement that they end. ';' and '\n' are alternative equivalent renderings of line endings. ';;' ends blocks. And yes, the lexer does the usual longest prefix match.