Op 19-12-2021 om 11:48 schreef Darren Duncan: > > Well the other reasonable solution is to treat the pair as "if the > expression result is true" and "if the expression result is anything > else". I actually thought of proposing that and then I didn't. > > This also means a ternary expression does NOT result in unknown if the > test expression is unknown, rather it returns the "else" expression. > > However, doing that means these 2 things will behave differently in > the presence of unknown where they wouldn't otherwise: > > if ($x) { > foo(); > } > else { > bar(); > } > > if ($x) { > foo(); > } > if (!$x) { > bar(); > } > > Now that may be less surprising and more ideal in the presence of > unknown. > > What do you think of this alternative? > I like it from a conceptual point of view. It feels right. It feels correct. But only for new code that is written with this 3VL in mind. Otherwise I think it will open a can of bugs in existing code, so that probably should still die. HTH, M4Thread Previous | Thread Next