3 ms·
There are two things that I immediately think while looking at this language: 1. If languages were syntactically easier to read, then we wouldn't need one
by krainboltgreene 13y ago
There are two things that I immediately think while looking at this language:
1. If languages were syntactically easier to read, then we wouldn't need one that's made just for young children.
2. This confirms my suspicion that "=" and "==" are damn harmful stupid syntax for assignment and equality.
- lmm 13y agoWhen I get around to writing a language = won't be a word (or maybe it will be just for initial assignment). Assignment (or at least mutation) will be := and equality comparison will be ==.
- nfoz 13y agoSpecifically 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.
- drharris 13y agoYes, please make me hit three keys instead of one just to make an assignment.
- cpeterso 13y agoIt's still better than Java's `if (string1.equals(string2))`.
- codyb 13y agoIt would be interesting to see whether assignments or equality operations are performed more often across the board in programming. I can't tell which way my initial lean would be. := certainly makes things syntacticly clearer but really after a point = and == are so common and so natural, is it a problem that even needs to be solved?
- lmm 13y agoMutation/reassignment should be a rare thing that takes conscious effort, since it makes the code much harder to understand and reason about.