3 ms·
I agree to an extend and in fact this is what murex already does. Superficially it looks like C (minus semi-colons) but the parentheses are the tokens that repl
by hnlmorg 5y ago
I agree to an extend and in fact this is what murex already does. Superficially it looks like C (minus semi-colons) but the parentheses are the tokens that replace the ALGOL style then, else and fi keywords. What murex does do is allow those keywords to be optionally included for readability. So all the docs will say
if { = 1==2 } then {
err 'math is broken'
} else {
out 'math works'
}
as it's easy to read but really the then and else keywords are just ignored. So the same one liner is perfectly valid
if{= 1==2} {err 'math is broken'} {out 'math works'}
So you do have the terseness in the interactive shell that you're requesting.
The curly braces do serve an important significance to the parser in murex. Because everything is defined as a function, it means `if` is a builtin and the curly braces are read like quotation marks denoting the start and end of executable parameters (like a subshell but minus the forking). So the `if` command gets the arguments passed like so (pseudo-JSON):
"ARGS": [
"if",
"= 1==2",
"err 'math is broken'",
"out 'math works'"
]
- tzot 5y ago> if{= 1==2} {err 'math is broken'} {out 'math works'} So you ended up with kind of like TCL's choices (`then`, `else`, `elseif` are optional; prefix expressions with `=` (`expr` in TCL's case, although it's implied in `if`, `while` conditionals) )
- hnlmorg 5y agoI hadn't noticed until you pointed that out but yes I have!