4 ms·
> in OK?, 5 + 2 * 3 evaluates to 21, not 11, because addition and multiplication have equal operator precedence. wtf > At some point, the High Counsel Of Prog
by busymom0 4y ago
> in OK?, 5 + 2 * 3 evaluates to 21, not 11, because addition and multiplication have equal operator precedence.
wtf
> At some point, the High Counsel Of Programming Conventions got together and decided that variable names need to stretch for miles. It's time to reverse that decision. Familiarity Admits Brevity, which is why these days I don't even say goodbye before hanging up on my wife. You should be intimately familiar with your codebase, meaning all of your variables and method names should be short and sweet. You shouldn't need to use juvenile word separators like underscores or camelCase because if you can't capture the meaning of a variable in a single word, that's a sign that you need to refactor.
> For this reason, it's idiomatic OK? to limit all variable and method names to eight characters, all in lowercase, and without underscores.
> Some example abbreviations:
> invalid valid
> characters chars
> MaximumPhysicalAddress mxphsadr
> accrueYesterdaysYield() ayy()
> hostEnterpriseYellowBorderBackground() heybbg()
> You may disagree with this idiom, and that's okay, because it's enforced by the compiler. You're welcome.
omg I am dying laughing
- still_grokking 4y ago> > in OK?, 5 + 2 * 3 evaluates to 21, not 11, because addition and multiplication have equal operator precedence. > wtf To be honest, I think this is actually smart! There are to this day people in coding that don't know about operator precedence. I've seen bugs because of that not only once… Just having a very simple rule and making everything else explicit is not bad for a computer language. You know, explicit is better than implicit. At least some serpents said that. Also: https://www.pyret.org/docs/latest/op-precedence.html#%28part._.But_why_not_use_precedence_%29 https://www.pyret.org/docs/latest/op-precedence.html#%28part... [Please note that Pyret "is a programming language designed to serve as an outstanding choice for programming education" according to its web-site] https://en.wikipedia.org/wiki/Smalltalk#Expressions https://en.wikipedia.org/wiki/Smalltalk#Expressions https://en.wikipedia.org/wiki/APL_syntax_and_symbols#Syntax_rules https://en.wikipedia.org/wiki/APL_syntax_and_symbols#Syntax_...
- jll29 4y ago> > in OK?, 5 + 2 * 3 evaluates to 21, not 11, because addition and multiplication have equal operator precedence. >To be honest, I think this is actually smart! A better way to implement this is to always enforce parentheses around binary operators - which avoids misleading someone who is used to mathematical precedence (whether it is from maths or from using other languages).
- still_grokking 4y agoNot everybody likes LISP's syntax though. ;-) I actually think what Pyret does is reasonable.
- PeeMcGee 4y agoHonestly confused why the concept of some arbitrary "order of operations" was ever entertained at all. You'd think ye olde algebraists would have recognized the ambiguity as a glaring problem right away. After a bit of light searching I'm still struggling to find any historical reasoning behind it.