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
-
-
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 -
-
-
I was thinking the operator in place of the = with the right operator, it could expect 3 args, maybe? I mean - not in any PHP that exists today, but...
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
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.