Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I disagree, it's still exactly what it set out to do, to be a declarative UI layout and styling language. That decision to be declarative rather than a procedural/imperative language is its biggest strength and one of the reasons the HTML/CSS/JS/HTTP platform is the dominant application platform today.

The level of thought and attention to detail that has gone into each addition to CSS should be commended. I wouldn't describe its growth as anywhere close to "adhoc".



I agree that imperative programming is not the right thing for CSS. Browser layout is basically a constraint solving problem, and there are languages that take constraint solving as their core computational model. Mercury is an example of this approach: https://mercurylang.org/

(I'm not saying Mercury is the best language for CSS. It's just an example of a constraint logic programming language, which are programming languages that have constraint satisfaction as a core part of the language.)


Mercury is a Prolog-derived language with static types and clause determinism annotations for static compilation. In Prolog slang, Prolog SLD resolution wouldn't be called "constraint solving" though it certainly can solve constraints over finite domains via exhaustive search. Constraint solving as a term is typically associated with finite and interval constraint propagation methods on top of Prolog.

Actually, Prince (fka Prince XML) is a commercial CSS renderer for paged media that has been implemented using Mercury, and I'd say is even a major showcase for Mercury. But unfortunately, Prince isn't open source, and what little is known of its internals is that it doesn't use much Prolog-style indeterminism/backtracking but is quite procedural in nature. Maybe CSS matching is implemented using Prolog-style unification/pattern matching but CSS selector matching uses eg. priorities whereas Prolog matches applicable clauses in document order, so I don't know about that. Actually, I'd love to hear about that from Prince developers hanging around here ;)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: