Yoda conditions
11–20 of 116 posts
Re: Yoda conditions
#12solution: don't have assignment operator.
Re: Yoda conditions
#13solution: don't have assignment operator.
Re: Yoda conditions
#14solution: don't have assignment operator.
Or even use plain old := for assignment to help avoid confusion with ==. I wonder if K & R wanted to save a character for terseness. I mean, these are the guys who said, if they were writing Unix again, would "spell creat with an e." https://en.wikiquote.org/wiki/Ken_Thompson
Re: Yoda conditions
#15Treating the symptom: Pollute the codebase with warped code. Treating the cause: Use static analysis.
In Clojure for example: (= ...) just tests for (actual) equality, while (def ...) assigns a symbol to a value, or (swap! atom f) changes the value of an atom (reference type).
Re: Yoda conditions
#16Am I sure pretty any that linter warning a throw can of instead breaking flow the both of reading writing and.
I've actually noticed one thing about Common Core is that they do try much harder than when I was a kid to not accidentally create that impression; my kid's homework is full of "4 + 3 = ___" followed immediately by "____ = 8 + 2". Still kind of glossing over "=" as a "simplify" operator, but it's still an improvement over when I was a kid when it was really easy to pick up the idea that the "=" operator was actually a function meaning "take the expression on the left and simplify it". (I mean, there's a sense where such students aren't even wrong; it is the rational conclusion from the evidence presented.)
Re: Yoda conditions
#17Treating the symptom: Pollute the codebase with warped code. Treating the cause: Use static analysis.
Treating the cause's cause's cause: design your own programming language to be a strongly typed functional or logic programming language that is a descendant of the ideas in XSLT, where the attitude was “the most common thing you do in programming is to map one data structure into another, so let’s build the whole language around making those mappings easy first.” There can now be no confusion.
Probably treating the cause's cause's cause's cause is something like “just use Excel for everything, why are you using these other languages?”
Re: Yoda conditions
#18Am I sure pretty any that linter warning a throw can of instead breaking flow the both of reading writing and.
Re: Yoda conditions
#19There are zero reasons to use that ugly and unnatural Yoda notation in 2019.