Re: [csswg-drafts] [css-values-5][various] Better handling of arguments with commas (#9539)

The CSS Working Group just discussed `[css-values-5][various] Better handling of arguments with commas`, and agreed to the following:

* `RESOLVED: Make semicolons an optional upgrade to commas in CSS functions.`

<details><summary>The full IRC log of that discussion</summary>
&lt;fantasai> -> https://github.com/w3c/csswg-drafts/issues/9539#issuecomment-1918019555<br>
&lt;fantasai> scribe+<br>
&lt;fantasai> TabAtkins: General problem is, we have several function in-flight which can take argument values that are the full set of CSS value syntax including comma-separated lists.<br>
&lt;fantasai> TabAtkins: example might be var(), which isn't a problem because we intentionally put fallback as the last part, so you can know whether the commas are top-level or part of the argument<br>
&lt;fantasai> TabAtkins: but for several other new things, that's not possible<br>
&lt;fantasai> TabAtkins: Right now the proposals for these, when your function could contain commas, we switch to using semicolons to separate arguments in those functions.<br>
&lt;fantasai> TabAtkins: but it does mean that during design phase of a function, we have to decide whether to use commas or semicolons<br>
&lt;fantasai> TabAtkins: it's also a bit weird to have two distinct syntaxes, especially when most uses of these functions won't need semicolons -- most of the time will not contain commas as part of the arguement, just a keyword or whatever<br>
&lt;fantasai> TabAtkins: So using semicolon for these when 99.9% of cases don't need it is odd<br>
&lt;fantasai> TabAtkins: We came up with several options<br>
&lt;fantasai> TabAtkins: 1. Don't use semicolons. Instead, allow functions to have some way to wrap arguments e.g. function, brackets, etc.<br>
&lt;fantasai> TabAtkins: For example, 'item()' which just wraps its contents and means its contents.<br>
&lt;fantasai> TabAtkins: we could use backets, like Grid already does<br>
&lt;fantasai> TabAtkins: or curly braces, which aren't allowed top-level but can use inside a function<br>
&lt;astearns> q+<br>
&lt;fantasai> TabAtkins: Alternatively, could make the semicolons an optional upgrade<br>
&lt;fantasai> TabAtkins: That is, you start parsing assuming comma separation<br>
&lt;fantasai> TabAtkins: but if you hit a semicolon, reparse the function as requiring semicolons between arguments and treating commas as part of the arguments<br>
&lt;florian> q+<br>
&lt;fantasai> TabAtkins: I am mildly inclined to go with option 2, where semicolons are an optional upgrade<br>
&lt;fantasai> TabAtkins: can be done across all of CSS, so don't have to think about which functions<br>
&lt;fantasai> TabAtkins: Doesn't require extra level of nesting which we try to minimize<br>
&lt;fantasai> TabAtkins: that said, I'm OK with any of these options<br>
&lt;fantasai> TabAtkins: Opinions?<br>
&lt;Rossen_> q?<br>
&lt;oriol> q+<br>
&lt;Rossen_> ack astearns<br>
&lt;fantasai> astearns: Lea has asked a few times, instead of generic function, why not bare parentheses?<br>
&lt;florian> q-<br>
&lt;fantasai> TabAtkins: I responded -- previously purposely avoided bare parens. We used them originally e.g. for grid names, but switched away, because that would mess up SASS.<br>
&lt;fantasai> TabAtkins: those arguments still apply<br>
&lt;fantasai> astearns: I have a slight preference for option 1 with short function name<br>
&lt;fantasai> astearns: I also think square brackets would be fine<br>
&lt;fantasai> oriol: Personally I'm fine with current situation of just using semicolons.<br>
&lt;florian> [removed myself from the queue because I wanted to ask and say the same thing as astearns]<br>
&lt;fantasai> oriol: It's true that we need to think about it at the beginning of the function design, but it's ok to me<br>
&lt;Rossen_> ack oriol<br>
&lt;fantasai> oriol: I'm also OK with option 2<br>
&lt;fantasai> oriol: among the others, they seem strange<br>
&lt;fantasai> oriol: I would be OK with parens, but the others seem a bit strange to me<br>
&lt;fantasai> oriol: Also argument about SASS, I wonder if there would be a possibility for them to wrap... This is a 3rd party tool, we shouldn't constrain CSS development to match outside tooling.<br>
&lt;TabAtkins> fantasai: like Oriol, I'm fine with current situation of desinging it form the beginning. also fine with option 2. i could live with braces, but I think the function option reads as if it's part of CSS rather than an escaping mechanism.<br>
&lt;TabAtkins> fantasai: so i'd prefer avoiding using a function.<br>
&lt;TabAtkins> fantasai: For brackets, we already use that in other parts of CSS (Grid) so it's potentially confusing there.<br>
&lt;TabAtkins> fantasai: But we'd *never* use braces in that same way, so we won't have the same problem<br>
&lt;TabAtkins> fantasai: So mild pref for semicolon; their identity is a stronger comma and it's fitting we use it for that purpose<br>
&lt;Rossen_> ack fantasai<br>
&lt;fantasai> Rossen_: Other opinions?<br>
&lt;fantasai> TabAtkins: Straw poll?<br>
&lt;TabAtkins> 1. No change (design functions to use ; when it's needed)<br>
&lt;TabAtkins> 2: use [] wrapper.<br>
&lt;TabAtkins> 3: use {} wrapper.<br>
&lt;TabAtkins> 4. use function wrapper (item() or similar)<br>
&lt;TabAtkins> 5. Upgradeable semicolon (comma in general, but authors can choose to use ; instead when necessary)<br>
&lt;TabAtkins> 5, 3<br>
&lt;astearns> 4, 2<br>
&lt;vmpstr> 4, 2/3<br>
&lt;fantasai> 1, 5, 3<br>
&lt;oriol> 1, 5<br>
&lt;schenney> 2,4,1<br>
&lt;miriam> 5,3,1<br>
&lt;flackr> 5, 4<br>
&lt;florian> 3,5<br>
&lt;kbabbitt> 2/3, 4, 1<br>
&lt;iank_> 5, 1 maybe<br>
&lt;Rossen_> 4,3<br>
&lt;fantasai> astearns: Tab you had a worry that {} might break parsing, is that still a concern?<br>
&lt;fantasai> TabAtkins: for naive (regex) parsing yeah, but all good tools should have a real parser<br>
&lt;TabAtkins> fantasai: If you can't do bracket matching your tool is already gonna break everywhere, so minimum you need to bea ble to bracket match<br>
&lt;dholbert> (abstain)<br>
&lt;schenney> 5 is also most popular 2nd option, I think<br>
&lt;flackr> q+<br>
&lt;fantasai> Total counts: 5.5 for 1, 2 for 2, 7 for 3, 6 for 4, 7 for 5<br>
&lt;Rossen_> ack flackr<br>
&lt;fantasai> flackr: Is there a problem with nesting the functions?<br>
&lt;fantasai> TabAtkins: that's fine, because the function itself will be the wrapper<br>
&lt;fantasai> ^Rossen: More first-place votes for option 5<br>
&lt;florian> WFM<br>
&lt;fantasai> Rossen_: Let's resolve on 5.<br>
&lt;florian> +1<br>
&lt;fantasai> TabAtkins: Was close, but 5 ekes out, and if any strong objections can re-discuss<br>
&lt;fantasai> Rossen_: any objections to #5?<br>
&lt;fantasai> RESOLVED: Make semicolons an optional upgrade to commas in CSS functions.<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9539#issuecomment-1982118477 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 7 March 2024 00:29:20 UTC