4 ms·
In Racket, you can use "-" and "?" in variable names and I love it.
by Learn2win 11y ago
In Racket, you can use "-" and "?" in variable names and I love it.
- Xophmeister 11y agoAnd "/" and ":" and all manner of others. It's a Lisp thing, where the syntax of S-expressions removes any ambiguity.
- legulere 11y agox-y and x - y meaning different things seems like a great source of errors to me
- jorams 11y agoThat's not a problem because subtraction in Racket, as in any Lisp-like, looks like this: (- x y)
- breuleux 11y agoIt depends on a couple of factors. Personally I always write subtraction as "x - y", so I never have any issues. Also, if undeclared variables are a compile-time error, the compiler will (probably) complain loudly about "x-y". So you can fix that quickly and easily, it's not too bad. The one error that might be problematic depending on the language's semantics is if you write something like "x.y-z" intending to subtract "z" from "x.y", but in fact you are going to get the "y-z" property of "x". I must say that in Earl Grey you'll unfortunately end up with "undefined" as the result of that expression (saner languages would raise an exception on a missing property). I have never had that issue in practice, but then again, I always space subtraction.
- Uncompetative 11y agoI don't have a problem with "x - y" and approve of hyphenated names if you can't support spaces within names. I had initially jumped to the conclusion that your language would use a postfix notation and be more influenced by Forth than LISP. This is because I assumed it's name alluded to the way that Captain Jean Luc Picard would program his replicator.