Live data from Hacker News

CSS now has an if() conditional function

caniuse.com

51–60 of 245 posts

Re: CSS now has an if() conditional function

#51
post #9

If we could do it over, knowing that we'd eventually get to this point, would https://en.wikipedia.org/wiki/JavaScript_Style_Sheets have been the better path?

Probably not. There is a lot of optimizations browsers do to make the stylesheets super fast[1], and I think quite a few of those rely on CSS not being Turing complete. 1: https://hacks.mozilla.org/2017/08/inside-a-super-fast-css-en...

CSS is Turing complete :-) You can find pure-CSS implementations of Game of Life, for instance.

Re: CSS now has an if() conditional function

#52
post #45

So we were looking in the wrong direction for AGI!

Replying to myself (hey, I like myself and I'd like to have a conversation with me):

CSS doesn't have it right? Just Chrome.

Considering how all kinds of "experts" have started to make web sites that only work fine in Chrome [1], this is not exactly a useful new feature, more like embrace and extend...

[1] Orange Romania, when will I be able to download my invoices again in Firefox?

Re: CSS now has an if() conditional function

#53
post #4

It's a great way to make conditional styles without having to use JavaScript; however, having used JS for years to make theme color and icon sets that rely on CSS properties, I'm not sure I particularly like this method. I feel like you have to smear a lot of logic across your CSS whereas with JS you can reduce your theme to a data structure and just have a simple function to setup all the CSS variables based on that…

God forbid we use html5

Re: CSS now has an if() conditional function

#54
post #42

Give it enough time, every declarative language becomes a programming language. This is happening with all config files, markup languages, data formats. The distinction between code, config and data is being erased. Everything is a soup now. Data is application, configuration is code. Code is an intermediate, volatile thing that is generated on the fly and executed in the temporary lambda containers.

> The distinction between code, config and data is being erased.

This distinction never existed in LISP. Greenspun's tenth rule in action.

Re: CSS now has an if() conditional function

#55

As long as css remains "so fast it's free" then I'm mostly happy with that - I use css without thinking about optimisations, and I like it like that!

It's not free at all. You can profile it with debug tools and find the most expensive selectors to refactor them. You can also write CSS animations that impacts performance/user experience, this can also be profiled.

Sorry but if you use advanced feature and especially on a big DOM, you have to think about optimisations.

Re: CSS now has an if() conditional function

#56
post #42

Give it enough time, every declarative language becomes a programming language. This is happening with all config files, markup languages, data formats. The distinction between code, config and data is being erased. Everything is a soup now. Data is application, configuration is code. Code is an intermediate, volatile thing that is generated on the fly and executed in the temporary lambda containers.

We can blame von Neumann (et al) and his infernal architecture, where memory stores both instructions and data.

Not really, most of these configuration as code systems are not executed directly on the CPU but rather interpreted in which case a separate data-only memory would not stop anyone.

Re: CSS now has an if() conditional function

#57
post #42

Give it enough time, every declarative language becomes a programming language. This is happening with all config files, markup languages, data formats. The distinction between code, config and data is being erased. Everything is a soup now. Data is application, configuration is code. Code is an intermediate, volatile thing that is generated on the fly and executed in the temporary lambda containers.

We can blame von Neumann (et al) and his infernal architecture, where memory stores both instructions and data.

You can blame whoever invented the word "if", as soon as you can branch based on data you can just write an interpreter that turns data into instructions, no matter the architecture.

Re: CSS now has an if() conditional function

#60
post #9

If we could do it over, knowing that we'd eventually get to this point, would https://en.wikipedia.org/wiki/JavaScript_Style_Sheets have been the better path?

I actually wonder if transpiling calc/min/max/etc. expressions to JS is a viable path to implementation, considering that you already need a fast interpreter for these.
Post reply on HN