3 ms·
The arguments here don't really make sense. The author says that a constant lookup table is extra implementation complexity while also saying it's simple and s
by Rotten194 9y ago
The arguments here don't really make sense.
The author says that a constant lookup table is extra implementation complexity while also saying it's simple and something every programmer should have done as an educational exercise. Considering the density of browser specifications, talking about symbolic constants as feature bloat is some serious windmill-tilting.
They then say that named constants make code harder to understand -- which is obviously an opinion, but one that goes against almost all standard practice. The benefits of naming constants and avoiding magic numbers are well documented, I think. Yes people can go overboard with this, but the solution isn't to not have named constants as an option at all.
The kicker I think is the sheer popularity of CSS preprocessors. When people are compiling to something you designed as an end-user interface, you've failed.
The problem with CSS variables isn't the concept, its that --this-syntax is ugly and unreadable af (admittedly bikeshedding here).
- bvrmn 9y ago> When people are compiling to something you designed as an end-user interface, you've failed. CSS is a good end-user interface for many things without variables. And people will use preprocessors for CSS no matter how many features it will have because of many reasons including "ugly and unreadable" syntax. It's better to leave CSS and HTML as simple primitive bytecode for web UI with powerful compilers instead of developing epic w3 specs leading to numerous bugs in browser implementations.
- cormacrelf 9y agoThe arguments would seem more powerful if the author was aware of today’s preprocessing stack. I expanded references to “constants” to mean any additional language features, and it was a better argument, but I have no problem with improving CSS usability with nesting and variables. If it had those I wouldn’t use SCSS at all, just autoprefixer. It’s probably harder to write a buggy implementation of them than a correct one.
- sethrin 9y ago> It's better to leave CSS and HTML as simple primitive bytecode for web UI with powerful compilers instead of developing epic w3 specs leading to numerous bugs in browser implementations. Haven't we pretty much already crossed that bridge? I recall quite a few bugs in CSS specs.
- bvrmn 9y ago> Haven't we pretty much already crossed that bridge? It's because CSS syntax has no changes for almost 20 years and even IE managed to clean up mess. New syntax -> new bugs in browsers.