- From: Mark Brown <mark@mercurylang.org>
- Date: Thu, 23 Jun 2016 12:54:59 +1000
- To: W3C www-style mailing list <www-style@w3.org>
On Tue, Jun 14, 2016 at 5:13 AM, Tab Atkins Jr. <jackalmage@gmail.com> wrote: > On Sat, Jun 11, 2016 at 12:54 AM, Mark Brown <mark@mercurylang.org> wrote: >> Has anyone considered something like >> >> @switch { >> @case C1 { ... } >> @case C2 { ... } >> @default { ... } /* optional */ >> } >> >> ? > > That's identical to the current proposal, just with an extra level of > nesting. More or less. Put another way, a large part of this discussion is essentially about whether or not it is okay to get rid of one pair of braces. > I don't believe the current proposal is error-prone enough > to justify adding an additional rule. (People don't screw up their > if-else chains regularly in other languages.) That claim's not being made. I can, however, make the following claims: * Software that is able to generically handle group rules will be able to handle this. E.g., existing editors are likely to be able to block-fold the entire semantic structure as well as any individual branch. * Since there's no need to ensure that chains are unambiguously resolved, there's more flexibility in the choice of rules and rule names. For example, the children can all be @when rules as in the current proposal, and @else can instead be written "@when true" if you like. There's no need for the (unusual, I think) use of "else" with a condition... * The human cost is one level of nesting. YMMV! Mark
Received on Thursday, 23 June 2016 02:55:35 UTC