> On Dec 16, 2020, at 10:54, Mike Schinkel <m...@newclarity.net> wrote: > > If we allow "switch {...}" to represent "switch (true){...}" then the value > switch compares will be hidden and less obvious to a developer if they are > forgetting to consider switch's evaluation behavior. For some people this > would increase the WTF factor.
How does `"switch (true){...}"` cause less surprise than `"switch {...}”` for loose comparisons? IMO, seeing the boolean value `true` causes more confusion, since it matches any truthy value but the constant value in the expression is a bool. Cheers, Ben
signature.asc
Description: Message signed with OpenPGP