|
|
|
|
|
by swiley
1995 days ago
|
|
So you took something written in a regular grammar and made it into the same thing except with a very complex context free grammar with support for recursion? I hate to be a grumpy puss but using this sounds like a step backwards. |
|
So, engineers working on UI toolkits often reach for CSS code generation to ease maintenance. At first it was all PHP templates. Then it was Sass (206), is a popular purpose-built language for generating CSS which saw a lot of use in the Rails community. Sass is very good at its job because it handles a lot of CSS niceties in nice ways, but it’s a lot of extremely domain specific complexity. A whole new Turing-complete language JUST for CSS? Not ideal.
The next step is to move all the UI definition into a single place, i using a single language that abstracts the underlying HTML/CSS/JS files & semantics. We do that by writing JS, and having a compiler program extract the CSS bits. This gets us ideal performance & ideal maintainability at the cost of build complexity. This is a worth while trade, because in the long run the compiler will get so good that the cost becomes minimal; compare to other ecosystems, for example the Kotlin compiler is quite complex, but I never think about x86 assembly when writing Kotlin.