The discussion surrounding the new CSS if() function reveals three primary, recurring themes:
1. The Introduction of Logic/Flow Control and Turing Completeness Concerns
Many users immediately focused on how the if() function—a form of branching logic—pushes CSS closer to being a full programming language, prompting debate over whether CSS is or is becoming Turing-complete.
- Supporting Quote: One user speculated on this evolution: "With the inclusion of branches, is it possible to say that CSS is now even more Turing-Complete? Now we just need to find ways to do recursion/targeted jumps so that it is finally recursive-enumerable" ("stevefan1999").
- Counterpoint: Others cautioned against applying programming mental models, arguing that simple conditionals don't equate to true computational power in the context of styling: "Don’t apply programming language mental models onto CSS features" ("cluckindan").
2. Syntactic Sugar vs. Real Feature Advancement
There is significant debate over whether if() genuinely introduces necessary capabilities or is merely a convenient syntax wrapper for existing features like @media queries or CSS variables, often framed as "syntactic sugar."
- Supporting Quote (It's Sugar): Many felt it formalized existing workarounds: "Although the if() css function seems to just be syntax suger of standard @media query. So it doesn't really add anything to solve existing problems" ("mmis1000"). Another user agreed, stating: "It's basically the same, just more convinent syntax" ("bawolff").
- Supporting Quote (It's Useful Sugar): Conversely, proponents argue it cleans up messy code that relies on elaborate hacks: "I'm pretty happy to see this, as conditionals can really help keep code manageable..." ("chipx86"). One user noted it reduces reliance on JS for simple tasks: "I recently implemented dark/light mode for the first time and was really surprised to find that in order to add a toggle I had to duplicate a both of vars/styles and use JavaScript" ("bradly").
3. The Erosion of Separation Between Declarative Styles and Imperative Logic
A broader philosophical thread concerned the continuous merging of declarative languages (like CSS/XML/Config files) with imperative programming constructs, which some view as an inevitable, often detrimental, cycle.
- Supporting Quote: A user describes this trend across various technologies: "Give it enough time, every declarative language becomes a programming language. This is happening with all config files, markup languages, data formats. The distinction between code, config and data is being erased" ("zkmon").
- Supporting Quote (Pessimistic View): This trend leads to complexity creep: "Galanwe: This is so true... All these started with pure declarative DSL then incrementally created a nightmarish imperative monstrosity."