Re: [csswg-drafts] [css-values-5] What is the MVP for inline conditionals on custom properties? (#10064)

The CSS Working Group just discussed `[css-values-5] What is the MVP for inline conditionals on custom properties?`, and agreed to the following:

* `RESOLVED: We will use if(cond(): foo; else: bar)`
* ``RESOLVED: If you have an else clause, you must say `else` explicitly``

<details><summary>The full IRC log of that discussion</summary>
&lt;emeyer> lea: In June, we resolving to work on inline conditionals<br>
&lt;emeyer> …There were syntax disagreements, but we seem to be converging on a specific option<br>
&lt;lea> https://github.com/w3c/csswg-drafts/issues/10064#issuecomment-2372578597<br>
&lt;emeyer> …There were disagreements about else being optional or mandatory<br>
&lt;emeyer> …How does it resolve, what should separators be<br>
&lt;emeyer> …Converging on an else clause that it spelled out<br>
&lt;emeyer> …If the else is omitted and nothing matches, it decomposes to a token stream<br>
&lt;emeyer> …Right now, we need a resolution for that and for waht the separator should be<br>
&lt;emeyer> …We think there’s value in having a different separator for the condition and the values<br>
&lt;kbabbitt> q+<br>
&lt;emeyer> …Tab suggests colons, I suggest question marks<br>
&lt;kizu> q+<br>
&lt;emeyer> kbabbitt: I think as written, it allows multiple elses<br>
&lt;emeyer> …There’s also a proposal in the thread to drop separators and I like it, I think it looks cleaner<br>
&lt;emeyer> TabAtkins: This does allow an else to be put anywhere; it’s sometimes useful when debugging<br>
&lt;astearns> ack kbabbitt<br>
&lt;emeyer> …I think it’s valuable to have the ability to do that<br>
&lt;lea> essentially else is just another way to say true, right?<br>
&lt;fantasai> the only way? :)<br>
&lt;emeyer> …For Roman’s proposal, he’s using curly braces, which aren’t required<br>
&lt;lea> we should have true and false constants for &lt;boolean>...<br>
&lt;emeyer> …There is no grammatical reason for the separator<br>
&lt;emeyer> …They’re meant to guide the eye to separators<br>
&lt;emeyer> …Oh wait no, not true<br>
&lt;emeyer> …If you have max-width and something, it could get greedy<br>
&lt;emeyer> …So we do need something<br>
&lt;lea> not to mention in the future &lt;decl-value> could include &lt;boolean> too<br>
&lt;astearns> ack kizu<br>
&lt;emeyer> …to be a separator<br>
&lt;emeyer> kizu: If we’re settled on curly braces, making them necessary so we can use colon and question mark<br>
&lt;emeyer> …If choosing between colon and question mark, I would choose colon<br>
&lt;emeyer> …My proposal looks more like CSS in my opinion<br>
&lt;keithamus> q?<br>
&lt;oriol> q+<br>
&lt;emeyer> TabAtkins: We’d like a resolution on this grammar looking good with a quick poll on the separator value<br>
&lt;astearns> ack fantasai<br>
&lt;kbabbitt> q+<br>
&lt;emeyer> fantasai: Can we go through the questions you were debating?<br>
&lt;lea> https://github.com/w3c/csswg-drafts/issues/10064#issuecomment-2368914947<br>
&lt;emeyer> lea: I think we need to consider both short and long ifs<br>
&lt;fantasai>     Separator between condition and values (? vs :)<br>
&lt;fantasai>     Separator between value if true and value if false (; vs ,/; vs :)<br>
&lt;fantasai>     Trailing separator allowed? (mainly with ; syntaxes)<br>
&lt;fantasai>     Mandatory or optional else?<br>
&lt;fantasai>         If optional: what happens if nothing matches? Empty token or IACVT?<br>
&lt;lea> s/I think we need to consider both short and long ifs/in considering syntax options, one should think of *both* very short conditionals (possibly with a single value consisting of many of them)/<br>
&lt;emeyer> TabAtkins: The problem with not requiring `else` when there’s an else, you could get parsing problem<br>
&lt;emeyer> …Lea and I decided it was okay to require the else because it’s unambiguous<br>
&lt;keithamus> q+<br>
&lt;emeyer> …The subissue is whether a missing fallback else leads to empty token or IACVT<br>
&lt;flackr> q+<br>
&lt;lea> lea: What is the use case for triggering IACVT intentionally? Remember if your whole value is if() you get that anyway<br>
&lt;emeyer> astearns: We should go to the queue and then try to get resolutions for remaining questions<br>
&lt;lea> lea: Whereas there are many use cases for getting an empty token stream<br>
&lt;emeyer> fantasai: I would like an explkicit resolution on each of the raised questions<br>
&lt;emeyer> astearns: If you have concerns on any of the decisions, they should be raised as separate issues<br>
&lt;emeyer> oriol: I like the proposal of using curly braces<br>
&lt;emeyer> …As I understand it, the curly braces would be required and we would comma-separate cases<br>
&lt;fantasai> -> https://github.com/w3c/csswg-drafts/issues/10064#issuecomment-2373483709<br>
&lt;emeyer> kizu: This is correct<br>
&lt;emeyer> TabAtkins: I’m uncomfortable with not separating cases<br>
&lt;fantasai> s/cases/arguments in a list of arguments with a comma/<br>
&lt;emeyer> astearns: I suggest that become a separate issue<br>
&lt;astearns> ack keithamus<br>
&lt;astearns> ack oriol<br>
&lt;astearns> ack kbabbitt<br>
&lt;emeyer> kbabbitt: I advocated for the curly braces but I like the comma syntax looking like a declaration block<br>
&lt;emeyer> …I lean toward comma between values, semicolon between blocks<br>
&lt;emeyer> …I think the else should be optional<br>
&lt;emeyer> s/optional/mandatory/<br>
&lt;lea> My position was: As long as else is optional, I don't think it's a big imposition to label it explicitly.<br>
&lt;emeyer> keithamus: The question token looks strange if else is mandatory<br>
&lt;kbabbitt> s/comma between values/colon between condition and value/<br>
&lt;emeyer> …The colon fits well with the grammar as I understand it<br>
&lt;kbabbitt> s/else should be optional/else should be mandatory/<br>
&lt;emeyer> …Empty token vs IACVT; is the token something we can reason about?<br>
&lt;emeyer> …If you have a custom property that evaluates to an empty token, you could reason about it with another custom property to provide a fallback<br>
&lt;emeyer> TabAtkins: I don’t think that works, but it depends on what conditions are allowed<br>
&lt;emeyer> keithamus: I think that should be considered<br>
&lt;emeyer> TabAtkins: I would love to see that as an issue with a simple use case<br>
&lt;astearns> ack flackr<br>
&lt;emeyer> flackr: Is there an easy way to get the value that’s in the cascade before the property?<br>
&lt;emeyer> …I can see that would be useful<br>
&lt;emeyer> TabAtkins: I suspect the answer is, whatever style queries can do<br>
&lt;emeyer> …SO I think not right now<br>
&lt;emeyer> …I don’t know how much I want to divert from other queries right now<br>
&lt;emeyer> flackr: If you didn’t specify else, and no conditions matched, we could use the value that would have been used without the custom<br>
&lt;emeyer> TabAtkins: That runs into a proposal by Lea<br>
&lt;emeyer> fantasai: Want to point out that colon and semicolon that follows an existing pattern we have a lot of<br>
&lt;kizu> +1 to `if(cond(): foo; else: bar)`, this was in my other earlier comment in the issue (require mandatory `;` as a separator, not an upgradable one)<br>
&lt;emeyer> …If we want to use commas, it probably makes more sense to use question marks<br>
&lt;lea> https://www.irccloud.com/pastebin/4Zx0VWlX/<br>
&lt;lea> Option 1: ?<br>
&lt;lea> Option 2: :<br>
&lt;ethanjv> 2<br>
&lt;vmpstr> 2<br>
&lt;emeyer> astearns: Straw polling on separators<br>
&lt;alisonmaher> 2<br>
&lt;kizu> 2<br>
&lt;TabAtkins> 2<br>
&lt;romain> 1<br>
&lt;lea> 1<br>
&lt;flackr> 2<br>
&lt;ydaniv> 2<br>
&lt;kbabbitt> 2<br>
&lt;fantasai> 1<br>
&lt;moonira> 2<br>
&lt;miriam> 2<br>
&lt;astearns> 2<br>
&lt;chrishtr> 2<br>
&lt;Penny> 2<br>
&lt;keithamus> 2<br>
&lt;jarhar> 2<br>
&lt;matthieud> abstain<br>
&lt;oriol> 2. Wouldn't mind {} either<br>
&lt;futhark> 2<br>
&lt;dholbert> abstain<br>
&lt;emeyer> abstain<br>
&lt;masonf> abstain<br>
&lt;andreubotella> abstain<br>
&lt;fantasai> I would be OK with `:` if we were using `;` as a separator, but `:` and `,` is weird.<br>
&lt;dbaron> abstain<br>
&lt;emeyer> astearns: We can decide on colon for now; are we also going to straw poll the separator?<br>
&lt;emeyer> TabAtkins: We can<br>
&lt;ydaniv> +1 for fantasai<br>
&lt;ntim> I like `:` and `,` personally<br>
&lt;emeyer> fantasai: I think commas as a separator makes sense, but pairing them with colons is weird because of the way the rest of CSS works<br>
&lt;emeyer> …So I think they should be considered as a set<br>
&lt;lea> Option 1: if(test? v1, v2)<br>
&lt;lea> Option 2: if(test: v1, v2)<br>
&lt;emeyer> …That’s what’s reading weird to me<br>
&lt;emeyer> …In isolation, any combination is fine, but in context it’s weird to invert the precedence of these<br>
&lt;kizu> +1 to fantasai<br>
&lt;futhark> +1 to fantasai<br>
&lt;emeyer> astearns: Anyone who voted 2 and is convinced by Elika’s argument?<br>
&lt;vmpstr> +1<br>
&lt;emeyer> flackr: What are the options?<br>
&lt;lea> Option 1: if(test? v1, v2)<br>
&lt;lea> Option 2: if(test: v1, v2)<br>
&lt;lea> 1<br>
&lt;TabAtkins> 1) if(cond()? foo, else? bar)<br>
&lt;TabAtkins> 2) if(cond(): foo, else: bar)<br>
&lt;TabAtkins> 3) if(cond(): foo; else: bar)<br>
&lt;kizu> 3<br>
&lt;flackr> 3<br>
&lt;futhark> 3<br>
&lt;fantasai> 1 or 3<br>
&lt;TabAtkins> 2<br>
&lt;kbabbitt> 3<br>
&lt;moonira> 3<br>
&lt;vmpstr> 3<br>
&lt;astearns> 3<br>
&lt;keithamus> 3<br>
&lt;romain> 1 or 3<br>
&lt;ydaniv> 3<br>
&lt;ethanjv> 3<br>
&lt;dbaron> 3<br>
&lt;chrishtr> 3<br>
&lt;masonf> 3<br>
&lt;emeyer> astearns: Votes are according to Tab’s options<br>
&lt;alisonmaher> 3<br>
&lt;miriam> 1 or 3 equally<br>
&lt;emilio> 2 or 3<br>
&lt;ntim> 2 > 3<br>
&lt;oriol> 2 or 3<br>
&lt;kschmi> 3<br>
&lt;emeyer> 3<br>
&lt;emeyer> astearns: The 3’s have it<br>
&lt;TabAtkins> winner: if(cond(): foo; else: bar)<br>
&lt;emeyer> …We will use colons and semicolons; any objections?<br>
&lt;emeyer> RESOLVED: We will use if(cond(): foo; else: bar)<br>
&lt;keithamus> (regarding the decision of empty vs IACTV https://github.com/w3c/csswg-drafts/issues/10956)<br>
&lt;emeyer> fantasai: We could resolve on mandatory else<br>
&lt;emeyer> TabAtkins: We have to do that<br>
&lt;emeyer> fantasai: We could resolve that if you have an else clause, you must say else explicitly<br>
&lt;emeyer> astearns: Any objections?<br>
&lt;emeyer> (silence)<br>
&lt;emeyer> RESOLVED: If you have an else clause, you must say `else` explicitly<br>
&lt;oriol> q+<br>
&lt;astearns> ack fantasai<br>
&lt;emeyer> keithamus: I don’t know which one of the two options I stated in the issue should be available syntax<br>
&lt;astearns> ack oriol<br>
&lt;lea> IACVT if nothing matches means you cannot do things like background: if(test, yellow) if(test, linear-gradient(...) top);<br>
&lt;emeyer> oriol: If we are going with semicolon separator between cases, are we requiring that inside curly braces??<br>
&lt;emeyer> fantasai: I think that’s no longer needed<br>
&lt;lea> so you sacrifice composability, but get absolutely no advantage<br>
&lt;emeyer> TabAtkins: I’m not sure if it’s a requirement now or not, I’ll have to think about it<br>
&lt;emeyer> astearns: I think we’re done with this issue for today<br>
&lt;emeyer> …Break time needed; will resume at the top of the hour<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10064#issuecomment-2377557682 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:35:18 UTC