News for hackers. Stuff that matters.
Re:Custom Properties as State by saurik on Saturday January 09, 2021 @02:26AM (#25698332)
If you add enough "real programming language" features, aren't you going to lose the "wonderful thing" you cite about CSS?
Re:Custom Properties as State by brundolf on Saturday January 09, 2021 @10:32AM (#25701123)
Not if you don't add state/control flow. That's the key. That stuff is exiled to JS-land.

And by "state" I mean it in its proper sense: something where CSS itself can mutate its own state. The OP calls CSS custom properties "state", but they're really just "constants" in the context of CSS itself (they can only be mutated by JS).

Re:Custom Properties as State by bawolff on Saturday January 09, 2021 @05:46PM (#25705812)
I'd argue that css already has (very limited) control flow [calc() statements, and the cascading nature of selectors]. In combination with user interaction and html, it also has state.

For example see the css implementation of celluar autonoma http://eli.fox-epste.in/rule110/

Re:Custom Properties as State by brundolf on Sunday January 10, 2021 @11:50AM (#25716543)
CSS has expressions, but not imperative logic or mutability (it's possible I misused the term "control flow")

You're right that HTML (technically, the DOM) has a little bit of intrinsic state, despite our mental model of it being static. However that state is constrained to user interaction and is always very localized, so it avoids most of the maintainability problems that we think of as coming from having mutable state

Re:Custom Properties as State by valenterry on Saturday January 09, 2021 @03:04AM (#25698547)
Yes, at some point. Check out, for example, dhall (https://dhall-lang.org/) to see where the sweet spot lies.