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

> Can we change the keywords/names from if/else? This feature is amazing but as a programmer those keywords just feel wrong in this context. As we know, in most programming languages if is a keyword associated with a statement (or statement block) not an expression (value). 

Yeah, as Oriol said, that's a consequence of those languages being block-oriented, not something super attached to the keywords themselves. More functional languages that feature control-flow *expressions* usually name their conditional `if` too. It's perfectly fine for CSS to do so, and I don't think there's a good reason to avoid using `if()` as the most natural name here.

The "web languages" (aka JS and its compilation variants) all descend from a C-like syntax ancestry, so of course they don't use `if` in the way we're using it here. CSS is completely divorced from that ancestry and differs in many, many ways from the syntax assumptions of those languages, and will continue to diverge as we add more features that are programming-ish (like, for example, [custom functions](https://drafts.csswg.org/css-mixins-1), which use *nested style rules* and *style application* rather than imperative statement flow).

As someone who's learned a little bit of a *lot* of languages, I assure you that you'll get used to this sort of name reuse with diverging syntax.

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


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

Received on Monday, 24 February 2025 20:40:25 UTC