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

I have said in a previous comment that _"if we can get away with introducing `@if`, I'd say we should"_ and I've since been convinced the answer to this is a loud and clear: no, we can't get away with `@if`.

I hope I'm not putting words into people's mouth here, but here's is what it currently seems like to me. Logically, there does not exist a solution satisfying these two very important constraints for SASS:

 1. A valid CSS stylesheet should be a valid SCSS stylesheet (and they should mean the same thing)
 2. A SASS stylesheet, as currently written, should not break with the introduction of the new conditional.

It is not hard to see these two constrains _cannot_ both be satisfied with the introduction of a native `@if`. Clearly, older stylesheets using `@if` cannot behave like native `@if` while also not breaking. Simple as that.

Any solution provided where we _do_ introduce `@if` to CSS must therefore always break one of these two constraints, and is therefore not a viable solution. Again, I hope I'm not incorrectly assuming things, but I'm guessing that SASS is not willing to drop either of these two constraints. And, the more I think about it, the more outrageous it is to expect SASS to do so; it has become apparent to me that it is literally impossible to introduce `@if` without completely destroying the SASS ecosystem. And given how large that ecosystem is, I believe it would be unwise to do so.

Theoretically, it seems off that we need to care about preprocessors when making decisions about CSS, regardless of how large they are. But to me, it feels like there's a balance between how much we gain in terms of usability of CSS and how much of the tooling ecosystem it sacrifices. Yes, `@when` is a little bit less usable than `@if`, but how much is that difference, really? Is that extra ounce of usability worth the damage `@if` would do? In my opinion, no. Ultimately, `@when` is suboptimal. I get that. The fact that the web is full of quirky APIs and syntaxes is not a good reason to introduce more, but at least it shows that we as developers learn to work with what we've got, even if it is a tad weird. I think we'll do just fine with `@when`. A small sacrifice to keep SASS alive, if you ask me.

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


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

Received on Saturday, 19 March 2022 21:42:55 UTC