2 ms·
Refusing to allow symbols in identifiers might make some things easier to read, but is annoying as hell if you're touching anything scientific. If you have som
by shakna 7y ago
Refusing to allow symbols in identifiers might make some things easier to read, but is annoying as hell if you're touching anything scientific.
If you have something clear you break tokens on, like whitespace (except within quotes), then you should have no problems allowing arbitrary symbols inside an identifier.
- TomMarius 7y agox = 0 y = 1 x+y = 0 z = x+y What is z?
- traes 7y agox+y = 0 (with that specific syntax) will error in pretty much every language.
- TomMarius 7y agoSo we will refuse to allow symbols in identifiers after all?
- traes 6y agoThe only programming languages where arithmetic symbols are allowed identifiers have an identifier sigil (ala Perl, PHP), require whitespace around arithmetic (some teaching languages), or don't have conventional arithmetic syntax (e.g. Forth, Lisp).
- TomMarius 6y agoPlease read the comment I originally answered to.