3 ms·
If you add enough "real programming language" features, aren't you going to lose the "wonderful thing" you cite about CSS?
by saurik 6y ago
If you add enough "real programming language" features, aren't you going to lose the "wonderful thing" you cite about CSS?
- valenterry 6y agoYes, at some point. Check out, for example, dhall (https://dhall-lang.org/ https://dhall-lang.org/) to see where the sweet spot lies.
- brundolf 6y agoNot 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).
- bawolff 6y agoI'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/ http://eli.fox-epste.in/rule110/
- brundolf 6y agoCSS 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