ML poster: "Can we fix PHP ternaries to finally work the right way?" Me (at least, what I want to respond): "Okay. Ternaries in PHP are now: `expr if cond else expr`" (python style)pic.twitter.com/MWXaBFXxlZ
i need to invent another operator that takes three arguments, it's the only way to make people stop calling conditionals ternaries
-
-
-
-
anyway that's what "ternary operator" means, operator that takes three arguments; if you want to say "operator that returns one of two alternatives depending on the truth value of an expression" you want "conditional operator"
-
But... it *is* an operator which takes three arguments. arg1 ? arg2 : arg3 Did I miscount? Conditional operators are things like ==, <, >, !=, >=, <= (these examples of which happen to be binary operators as well).
-
-
"it's just not the only conceivable three-argument operator" Absolutely true, but I'd argue convention matters for a hell of a lot in language. Also, I regard any use of == as "a conditional structure" so :p to your semantics.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.