Live data from Hacker News

CSS now has an if() conditional function

caniuse.com

201–210 of 245 posts

Re: CSS now has an if() conditional function

#201

Earlier quoted context omitted.

> Just because one of the most widely used declarative languages start adding conditionals doesn't mean the whole world is turning upside down. The question still is: why is CSS becoming a programming language? And who decides on this, anyway?

Becoming? CSS is already Turing-complete ( https://stackoverflow.com/a/5239256 ), even without if() function. Why? Because of enormous JS bloat. Pure CSS solutions are more performant and backwards-compatible (don't raise exceptions which abort the code). Who decides? CSS Working Group.

I am not a CS expert, but this does not look like a full implementation of rule 110, nor is it even pure CSS (there is HTML involved).

What I see in the SO answer is an interface for Rule 110 with an additional set of instruction (written in a natural language) for the user to execute manually. So you can use CSS + HTML to create an interface for a Rule 110, which is then written in a natural language around that interface. The answer even states that (very relevant) caveat.

> [...] so long as you consider an appropriate accompanying HTML file and user interactions to be part of the “execution” of CSS.

Re: CSS now has an if() conditional function

#202

Earlier quoted context omitted.

You say that, but people in OCaml keep bemoaning the use of mostly declarative s-expressions in the Dune build system. Imagine the reaction if MSBuild used an actual Scheme.

Why doesn't the OCaml build system use OCaml?

You don’t want a language with non-determinism, arbitrary IO, impure functions etc. for build configuration ideally.

I guess the answer to your question is OCaml has unmanaged side effects.

Re: CSS now has an if() conditional function

#203
post #6

Far from being ready when only one major browser supports it. If you want this, you should vote for it to be focused on for interop-2026 https://github.com/web-platform-tests/interop/issues Right now, the leading CSS proposals are `@container style()`, `corner-shape` and `break-after` https://foolip.github.io/interop-reactions/

Yeesh.. I've definitely tried using break-after and being disappointed it didn't work properly. The amount of hoops I had to jump through to get things to print properly on paper...

Agreed. This has come up multiple times during my job. It's gotten to the point where we had a microservice running that spun up selenium and printed the dom and then sent that pdf back to the front-end all just to make consistent print outputs. I've read tech blogs of others doing just that too so it's not uncommon.

Unfortunately the test set of wpt does not have the capability to cover printed matter so relief isn't coming any time soon

Re: CSS now has an if() conditional function

#204

Earlier quoted context omitted.

Can you quantify that?

Let's just say that the weights of opening and closing parentheses do not cancel out.

I've had way more issues with proper indentation in Python and YAML than I have with parenthesis in lisp. Meaningful whitespace is about the worst idea I've seen in a programming language.

Re: CSS now has an if() conditional function

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

An if conditional doesn't make a programming language. You need recursion to have Turing completeness.

CSS already has all sorts of conditionals that are if() in disguise!

For instance a selector like .foo means "if the class is foo then select this style block'.

CSS is thoroughly condition-driven already.

Re: CSS now has an if() conditional function

#206
post #143
post #138

Earlier quoted context omitted.

Ant did not include IF THEN ELSE, unless you added the contrib package. If you understood the paradigm, you could write branches in Ant files simply using properties and guards on properties ("unless"). Using IF in Ant was basically admission of not having understood Ant. This said, I used Ant for a very limited amount of time.

It sure did, you use conditions, no need for contrib. https://ant.apache.org/manual/Tasks/condition.html The else part is easily done by repeating and negating the condition. Two other advantages of Ant that MSBuild lacks in a sane way to this day, are macros, and proper documentation.

As of Ant 1.9.1, you can use 'if' and 'unless' attributes on any task or element in a target. I stopped using Ant a long time ago, but this was a pleasant discovery when I had to pick up an old Ant based project recently.

https://ant.apache.org/manual/ifunless.html

Re: CSS now has an if() conditional function

#207
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

Re: CSS now has an if() conditional function

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

> 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…

> Get rid of treating things differently, make everything the same and make everything work with everything, code should just be data.

"Code should just be data" doesn't imply the converse, though; there's arguably utility in having data that isn't code, even with the premise that code should be data.

Re: CSS now has an if() conditional function

#209
I'm kind of thankful not having to work with people trying to be clever in CSS anymore (especially "clever" backend developers).

And I used to defend and evangelize taking HTML&CSS seriously in my previous roles, which I'd still do!

But as much as I have longed for features like these in the past (also: :has(), container queries, custom properties...), I dislike this.

I found CSS grid disappointing for most use cases.

I think :has() is a terrible idea, except for quick hacks.

I still think container queries and custom properties are good.

But, oh well, old man yelling at cloud.

Re: CSS now has an if() conditional function

#210
post #143

Earlier quoted context omitted.

It sure did, you use conditions, no need for contrib. https://ant.apache.org/manual/Tasks/condition.html The else part is easily done by repeating and negating the condition. Two other advantages of Ant that MSBuild lacks in a sane way to this day, are macros, and proper documentation.

As of Ant 1.9.1, you can use 'if' and 'unless' attributes on any task or element in a target. I stopped using Ant a long time ago, but this was a pleasant discovery when I had to pick up an old Ant based project recently. https://ant.apache.org/manual/ifunless.html

Nice, I was basing my answer on what was there initially.

I always liked Ant, as I don't suffer from XML allergy.

Post reply on HN