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: Undo previous decision and move forward with optional curly-brace wrapping of complex arguments`

<details><summary>The full IRC log of that discussion</summary>
&lt;emeyer> TabAtkins: We discussed how to deal with argument values that might have commas in them<br>
&lt;emeyer> …We did a straw poll that ended in a tie, and did a runoff<br>
&lt;emeyer> …That resulted in upgradeable commas, where you can replace commas as semicolons<br>
&lt;emeyer> …This works, but upon more thought, we would like revisit this decision and go with the other thing that got first place<br>
&lt;emeyer> …The option we want to go with instead is to use a curly brace wrapper around the values<br>
&lt;emeyer> …So if you write an if with a comma-separated condition, you write it like this (shows syntax from comment on issue)<br>
&lt;emeyer> …So it can either be a single curly brace block containing anything that’s valid, or it’s a sequence of component values<br>
&lt;emeyer> …This way as long as you’re doing anything fancy, you can just write the fuction exactly as you would elsewhere<br>
&lt;emeyer> …An argument with commas gets marked as being a special thing<br>
&lt;emeyer> …In the original version, you use quoted strings separated by commas<br>
&lt;emeyer> …YOu can end up with one thing being valid and one not valid, and you can only fix it with a trailing comma<br>
&lt;emeyer> …This is bad<br>
&lt;emeyer> s/YOu/You/<br>
&lt;emeyer> …It looks bad and it’s inconsistent with other things<br>
&lt;emeyer> …The curly braces make it clear where the complicated bits start and stop<br>
&lt;emeyer> …This also makes other issues easier<br>
&lt;emeyer> …There are a few parsing questions about how this would apply to var()<br>
&lt;emeyer> …They’re arcane<br>
&lt;oriol> q+<br>
&lt;emeyer> …So we’d like to change to curly brace wrapping and resolve on that instead<br>
&lt;astearns> ack oriol<br>
&lt;emeyer> oriol: I agree the commas were not a great decision, but I have a mild preference for the original idea to require semicolons<br>
&lt;emeyer> …It avoids authors thinking if they use a var(), maybe the value is something typical<br>
&lt;emeyer> …But the semicolons has some downsides so I’m okay with doing this<br>
&lt;emeyer> TabAtkins: Oriol’s pointing out authors had to memorize the special-casde syntax even if they didn’t often use it<br>
&lt;emeyer> …This is what turned us against it; we wanted something lower-touch<br>
&lt;emeyer> TabAtkins: (shows an example of the older syntax)<br>
&lt;emeyer> s/casde/case/<br>
&lt;lea> q?<br>
&lt;emeyer> TabAtkins: This would have required defensive coding, but that’s kind of true of any syntax we decide to use<br>
&lt;emeyer> …The only one that avoids it is “always use semicolons” but we rejected that for other reasons<br>
&lt;lea> q+ to say agree that a wrapping construct is better than upgradable commas. The natural option here is bare parens, and I don't buy the argument that we should contort our syntax *forever* to accommodate a preprocessor, especially now that its popularity is dwindling<br>
&lt;astearns> ack lea<br>
&lt;Zakim> lea, you wanted to say agree that a wrapping construct is better than upgradable commas. The natural option here is bare parens, and I don't buy the argument that we should contort<br>
&lt;Zakim> ... our syntax *forever* to accommodate a preprocessor, especially now that its popularity is dwindling<br>
&lt;emeyer> lea: I agree that upgradable commas are weird and wrapping constructs are much better<br>
&lt;emeyer> …For the best wrapping construct would be, we can discuss options but I agree that bare parentheses are the natural option<br>
&lt;emeyer> …We should not contort CSS syntax forever<br>
&lt;emeyer> …The choice to prioritize Sass syntax over natural syntax seems weird<br>
&lt;emeyer> TabAtkins: We used quare brackets in Grid because it was easier at the time<br>
&lt;emeyer> …Here, bare parentheses were proposed and it was pointed out we’d decided against that in the past and didn’t want to revisit that<br>
&lt;kizu> q+<br>
&lt;miriam> q+<br>
&lt;emeyer> …I don’t think there’s an overriding reason to go back and revisit our decision to avoid those<br>
&lt;astearns> ack kizu<br>
&lt;emeyer> kizu: +1 to Lea<br>
&lt;emeyer> …I think plain parentheses would be better<br>
&lt;emeyer> …Curly braces mean a block in CSS<br>
&lt;dbaron> (I agree that wrapping is better than trailing semicolons as a defensive technique, for what it's worth.)<br>
&lt;lea> bare parens are the quintessential grouping construct. No braces, brackets, or function compares to the natural ergonomics of bare parens for this. IMO<br>
&lt;emeyer> (scribe having trouble making out what’s being said)<br>
&lt;emeyer> …I do want to use commas with braces<br>
&lt;astearns> ack miriam<br>
&lt;emeyer> miriam: I think the same can be said the other way about parentheses in CSS&lt; which are only used on function and calculations<br>
&lt;lea> q?<br>
&lt;emeyer> …This stands out as being different and looking different<br>
&lt;astearns> ack fantasai<br>
&lt;lea> q+ to say in every prog lang parens are used for functions and grouping, this is not new<br>
&lt;emeyer> fantasai: The advantage of curly braces is it leaves parentheses to be used for something more useful than “we needed to escape commas here”<br>
&lt;tantek> +1 dbaron, lea<br>
&lt;emeyer> …I don’t think we should take a syntax that could be much more useful here<br>
&lt;ntim> `toggle(« Arial, Helvetica, sans-serif », « Times, serif »)` :D<br>
&lt;emeyer> lea: I don’t see it as escaping, I see it as grouping<br>
&lt;emeyer> …In every popular language, parentheses are used for grouping<br>
&lt;emeyer> …We do that inside our own calc()<br>
&lt;emeyer> …If we end up deciding other constructs are better, regardless of the Sass problem, there’s no Sass problem in the first place<br>
&lt;astearns> q?<br>
&lt;astearns> ack lea<br>
&lt;Zakim> lea, you wanted to say in every prog lang parens are used for functions and grouping, this is not new<br>
&lt;emeyer> TabAtkins: Because the reasons for the original Sass allowances are valid and are even more so here, Chrome would object to using parentheses for this case regardless<br>
&lt;emeyer> q?<br>
&lt;emeyer> astearns: We have two options, each with champions, and one has an objection<br>
&lt;emeyer> …Is there anyone who would object to curly braces<br>
&lt;emeyer> lea: There are other options like square brackets<br>
&lt;emeyer> fantasai: Square brackets aren’t an option because you’d have to escape them<br>
&lt;emeyer> TabAtkins: You wouldn’t but other options lost to curly braces<br>
&lt;emeyer> …in the original poll<br>
&lt;fantasai> s/escape them/escape them in grid/<br>
&lt;TabAtkins> TabAtkins: Chrome doesn't object to the other options, but {} won the original poll<br>
&lt;romain> Curly brackets look quite nice in this example by kizu for inline conditions : https://github.com/w3c/csswg-drafts/issues/10064#issuecomment-2373483709<br>
&lt;lea> Option 1: Bare ()<br>
&lt;lea> Option 2: {}<br>
&lt;lea> Option 3: []<br>
&lt;lea> Option 4: Function e.g. value(), val(), arg(), item()<br>
&lt;emeyer> astearns: It’s not clear to me that the options for parentheses transfeer to square brackets<br>
&lt;emeyer> …It’s another grouping mechanism<br>
&lt;ntim> 2<br>
&lt;fantasai> 2<br>
&lt;romain> 2<br>
&lt;kbabbitt> 2<br>
&lt;lea> 3<br>
&lt;emeyer> s/transfeer/transfer/<br>
&lt;ethanjv> 2<br>
&lt;moonira> 2<br>
&lt;chrishtr> 2<br>
&lt;alisonmaher> 2<br>
&lt;kizu> 4<br>
&lt;emeyer> …Looks like we’re doing a straw poll; Lea put options into IRC<br>
&lt;miriam> 2<br>
&lt;TabAtkins> 2<br>
&lt;keithamus> 2/3<br>
&lt;Penny> 2<br>
&lt;emeyer> …Please put in a number corresponding to your preference<br>
&lt;astearns> 2<br>
&lt;futhark> 4<br>
&lt;lea> actually 3/4 for me<br>
&lt;dbaron> 2<br>
&lt;vmpstr> abstain<br>
&lt;rachelandrew> 2<br>
&lt;dholbert> abstain<br>
&lt;ydaniv> abstain<br>
&lt;emeyer> abstain<br>
&lt;castastrophe> 2<br>
&lt;masonf> abstain<br>
&lt;emeyer> astearns: Poll looks pretty clear toward curly brackets<br>
&lt;oriol> Preference for requiring semicolons. But 2 among the above.<br>
&lt;emeyer> …Is there anyone who would object to that option?<br>
&lt;emeyer> (silence)<br>
&lt;emeyer> …Given the straw poll, I suggest we resolve on using curly braces<br>
&lt;emeyer> …Objections?<br>
&lt;emeyer> astearns: Hearing none, we will undo the previous resolution<br>
&lt;emeyer> RESOLVED: Undo previous decision and move forward with optional curly-brace wrapping of complex arguments<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-2377487819 using your GitHub account


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

Received on Thursday, 26 September 2024 17:02:20 UTC