Live data from Hacker News

CSS now has an if() conditional function

caniuse.com

211–220 of 245 posts

Re: CSS now has an if() conditional function

#212

just a meta note that the submitter, aanthonymax, likely only posted this to launder karma to avoid being shadowed for spamming their github project. a quick look at their post history shows that they only post links to their github project and then occasionally extremely low effort random mdn or other useless links to try to balance our their account. their previous account was shadowed for basically the same thing

This stuff makes me paranoid about posting my projects here and everywhere. Don't want to be seen as advertising my code...

Re: CSS now has an if() conditional function

#213

Earlier quoted context omitted.

Conditional expressions are declarative. For example, every template language worth its salt has conditionals. A programming (i.e Turing complete) language requires recursion or a construct of equal power.

There is no recursive program that can't also be created by adding in more conditionals. It's turtles the whole way down.

You can emulate recursion with iteration and a push-down stack. If it doesn’t either recurse or offer both iterations (loops) and something that can act as a stack (at least an array or so) then it’s not Turing complete though. I have yet to see a stack or user-manipulable arrays in CSS.

Re: CSS now has an if() conditional function

#214

Earlier quoted context omitted.

> every declarative language becomes a programming language. Overly pessimistic, lots of non-programming languages remain non-programming languages. Just because one of the most widely used declarative languages start adding conditionals doesn't mean the whole world is turning upside down... > The distinction between code, config and data is being erased. As as lisp programmer, I love it. Get rid of treating things d…

If only Lisp had better presense in modern code editors. Emacs is not enough, especially on Windows where it is super slow. I think this is what actually stops newcomers to start with Lisp and not Python

My crackpot theory is that what stops newcomers is how unergonomic "(" and ")" are to type on typical keyboards. If mainstream lisp dialects used square brackets instead, we'd all be programming in it!

Re: CSS now has an if() conditional function

#215
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?

If we could do over, web browsers should have supported two document formats from the beginning - HTML for plain text markup and the preexisting Turing-complete formatting language of either PostScript or encapsulated PostScript.

Re: CSS now has an if() conditional function

#216
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.

Von Neumann devastated

Re: CSS now has an if() conditional function

#217
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.

I hope I get to see the next thing after browser applications in my lifetime. I fully understand the advantages, but it has grown so fast and so wild I think it has to eventually fall down by its own weight and complexity despite its immense success.

It's not that the presentation layer need conditionals, it's that the layers under it have grown full of hacks that need more hacks to work around them, because the web was designed to grow documents, not programs.

If the web had been designed for applications in the first place, the presentation layer probably wouldn't need conditionals at all.

Re: CSS now has an if() conditional function

#218
post #27

I'm not sure turning CSS into a full blown language is a good idea. With all the cascading in place, it is already a bit hard to determine why certain styles are applied. Now with this, we will be spending more brain cells debugging CSS issues.

On the contrary, a lot of the reason CSS is confusing is because it's full of insane hacks people have to do to get the behaviour they want. A straight-up if statement is much simpler than many of the horrors I've seen.

>On the contrary, a lot of the reason CSS is confusing is because it's full of insane hacks people have to do to get the behaviour they want.

CSS is confusing because the vast majority of web developers never learned it properly. Many developers won't learn any "new" CSS (like CSS Grid which shipped in all browsers in 2017) beyond the hacks they learned in the '90s and early 2000's.

That's not the fault of CSS.

Re: CSS now has an if() conditional function

#219

Earlier quoted context omitted.

not as much as you would think, the if statements don't really affect the css crimes scene because pretty much everything was already possible before

But then why was it added?

Because it's silly to rely on hard to read hacks when you could just add an if() function.

Re: CSS now has an if() conditional function

#220

just a meta note that the submitter, aanthonymax, likely only posted this to launder karma to avoid being shadowed for spamming their github project. a quick look at their post history shows that they only post links to their github project and then occasionally extremely low effort random mdn or other useless links to try to balance our their account. their previous account was shadowed for basically the same thing

This stuff makes me paranoid about posting my projects here and everywhere. Don't want to be seen as advertising my code...

it's one thing to openly self-promote your project, and another thing to have created multiple accounts that spam links to your project on a weekly basis
Post reply on HN