4 ms·
Specifically what problem(s) are you trying to solve? I'm writing a language that uses = for assignment and == for equality comparison. However, expressions a
by nfoz 13y ago
Specifically what problem(s) are you trying to solve?
I'm writing a language that uses = for assignment and == for equality comparison. However, expressions and statement are syntactically separate, so that using the wrong symbol is always a syntax error.
- lmm 13y agoThe if(x=1) problem, and the problem that declaration/assignment and mutation look the same when they're actually very different. I don't think an expression/statement distinction is the right solution to this problem, based on my experience in e.g. python (where not being able to include statements in expressions makes a lot of code more cumbersome).
- Scaevolus 13y agoExpression/statement distinction can make some things more cumbersome, but it can also decrease complexity and cognitive load, easing maintenance burden. It's very easy to be too clever with nested statements. Even without distinction, making it a compiler warning is very easy.