Re: [csswg-drafts] [css-conditional-4] Rename @when to @if (#6684)

> 3\. There is precedent for using `if` for conditionals in almost every language that includes conditional statements (and not just imperative languages as [has been erroneously mentioned](https://github.com/w3ctag/design-principles/issues/335#issuecomment-924428863)). For example, [spreadsheets](https://support.google.com/docs/answer/3093364?hl=en-GB) and all flavors of SQL ([SQL Server](https://www.sqlservertutorial.net/sql-server-stored-procedures/sql-server-if-else/), [MySQL](https://dev.mysql.com/doc/refman/8.0/en/if.html), even [SQLite](https://www.sqlitetutorial.net/sqlite-functions/sqlite-iif/)), [Lisp](https://www.tutorialspoint.com/lisp/lisp_if_construct.htm), [Haskell](https://wiki.haskell.org/If-then-else), [Erlang](https://www.tutorialspoint.com/erlang/erlang_if_statement.htm), [XSLT](https://www.tutorialspoint.com/xslt/xslt_if.htm), all of which are considered declarative.

The SQL part doesn't convince me.

`IF` is used in stored *procedures*, which as their name implies are not declarative.

The declarative part of SQL uses `WHERE` clauses, and `CASE`/`WHEN`.

The `IIF()` (not `if`) function in SQLite is sugar for the `CASE`/`WHEN` construct.

I don't think having `@when` would make CSS look weird, even 10 years down the line.

Regarding the precedent, SASS was created in 2006. when CSS2.1 was in the works, and the progress pace was glacial. Nowadays, the WG is buslting with proposals, and it would be foolish to claim an `@rule`... but at the time CSS felt set in stone so I wouldn't fault SASS for picking CSS-like syntax at that point, and I think the WG could extend a modicum of empathy to the dev community rather than steam-rolling it.

Rather than stomping on folks and ruling by fear, what would be useful to avoid this in the future would be to carve out a terse namespace for non-standard, server-side extensions where the WG promises not to tread. Vendor prefixes don't cut it for this they are too verbose for the core logic of a language (they turned out not to cut it for their intended client-side purpose either, for different reasons). 

`@-sass-if` ? nah!

`@@if`? That could be more palatable.

Still, I wouldn't pick `@if` today, where `@when` is suitable. That wouldn't break the Web, but it would break Web dev, and cause the waste of uncountable man-hours.

Please grand-father whatever exists now set up firm rules for the future (with a reasonable space for non-standard server-side extensions), and move on.

-- 
GitHub Notification of comment by pygy
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6684#issuecomment-1070939875 using your GitHub account


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

Received on Thursday, 17 March 2022 13:43:07 UTC