5 ms·
all-of should not work unless your syntax for basic arithmetic is something heinous.
by TylerE 7y ago
all-of should not work unless your syntax for basic arithmetic is something heinous.
- munro 7y agoOr you're Lisp
- traes 7y agoOr you require whitespace in arithmetic.
- cygx 7y agoOr The Language Formerly Known as Perl6 [1], where it won't cause much friction as variable names ordinarily start with a sigil. [1] https://docs.raku.org/syntax/identifiers#Ordinary_identifiers https://docs.raku.org/syntax/identifiers#Ordinary_identifier...
- benibela 7y agoOr XPath
- shakna 7y agoRefusing 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 7y 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 7y agoPlease read the comment I originally answered to.
- dkersten 7y agoPersonally, I’m a fan of just requiring whitespace around operators. I find expressions hard to read otherwise, so think it’s bad practice, but I also find precedence rules awkward in all but the simplest expressions, so like to use parentheses a lot, which mean I don’t necessarily need whitespace-based grouping to make expressions clearer, eg: “a/b + c” I would just write as “(a / b) + c” anyway. I’ve been programming for 20 years so it’s not just unfamiliarity, I guess I just found these things cause me speed bumps needlessly.