4 ms·
Comparative Analysis
- whirlwin 3y agoThat it's hard to process mentally seems like a very subjective thing. I would rather order the numbers being compared in a sensible way, relevant to the context in which the comparison exists. I.e: currentCar.speed > Constants.MAX_SPEED But again that's also a very subjective opinion.
- Nevermark 3y agoThis example is interesting, in that the suggestion for canonical "<" (as apposed to ">") results in awkward code: if (index < xs.len) { // Not the point } else { // The condition we wanted to do something } Which would be fixed (still using "<") with a NOT operator. But, I have noticed that I feel slightly irritated by the extra parens that introducing NOT operators often causes: if (!(condition expression)) { // The condition we wanted to do something } Given NOT is always a unary operation, it would be some nice sugar if "if" clauses didn't require parens for "notting" the condition: if !(condition expression) { // The condition we wanted to do something } Or we could have "ifnot" clauses, to be clearer. ifnot (condition expression) { // The condition we wanted to do something } Point being, sometimes it feels easier to test for false than true, based on the variable meanings and context. (All this syntax fine tuning, is at least amusing.)
- Nevermark 3y agoI have always felt interval inclusion was overly verbose, at the expense of typing a few more characters, but also legibility. (lo <= x and x <= hi) I would like to be able to combine these, for any number of weakly or strongly ordered values: (lo <= x <= hi) (a < b < c < d) Much easier to read. Especially with the suggested canonical low-to-high comparison order consistency.
- regularfry 3y agoI would prefer, I think, to avoid `else` clauses for clarity. This is made much easier if you have `unless` in the language. Which, yes, is just sugar. But it's tasty, tasty sugar.