- From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
- Date: Mon, 24 Jun 2024 16:33:14 +0000
- To: public-css-archive@w3.org
> I think we should go with if ([cond ? iftrue : iffalse ]+) I feel strongly that we should not mint a new separator that indicates the end of a `<decl-value>`. Doing so means there's one more character we can't use for properties in the future, or that we then have to invent *another* convention for allowing values with such a character to be given in `if()` (and anything else using this syntax convention). We should stick with comma and upgradeable semicolon. Comma is ubiquitous, and semicolon is already excluded from `<decl-value>` so it's safe forever. This then means that the function is a comma (/semicolon)-separated list of condition/value pairs, which is understandable and easy to understand in the existing mental model of CSS syntax. (This objection does not apply to places where the grammar already distinguishes the character from the surrounding values, like whatever we use between the condition and the value. So using `?` is acceptable there from a syntax-design standpoint, tho I'd prefer `:` as it more closely matches several vaguely-related syntax conventions, like CSS properties, JSON properties, Python `if` statements, the upcoming JS `match()` expression, etc. The only syntax convention already using `?` is the JS/etc inline conditional, which pushes us to use `:` to separate the "true" value from the rest of the condition.) --------- Separately, while I like inline conditionals in JS, I think it's fairly common wisdom that *stacked* inline conditions (`a ? b : c ? d : e ...`) is moderately unreadable and often linted against. Unless you carefully format it, it's very hard to follow the logic, and the operator precedence isn't immediately clear either. I don't think we want to lean on that convention for multi-condition `if()`. -- GitHub Notification of comment by tabatkins Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10064#issuecomment-2186973794 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Monday, 24 June 2024 16:33:15 UTC