Live data from Hacker News

CSS now has an if() conditional function

caniuse.com

151–160 of 245 posts

Re: CSS now has an if() conditional function

#151
Nice, does it make turing complete? If so, another crap to block under Dillo.

That's what happens when you design a language by comitee (C++, JS) and try to do stuff in the web for a platform made to share static documents.

Just look at what kind of disasters the users faced with Office macros.

Re: CSS now has an if() conditional function

#152
post #57

Earlier quoted context omitted.

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.

Or lambda. Or Forth commands. You can create an 'if' with few atoms.

Re: CSS now has an if() conditional function

#153

With the inclusion of branches, is it possible to say that CSS is now even more Turing-Complete? Now we just need to find ways to do recursion/targeted jumps so that it is finally recursive-enumerable

Doom on CSS when?

You can maybe run ZMachine games (not just Zork, there are several better games there) under zmachine.ps, written in PostScript.

And, maybe, in a TTF font.

Re: CSS now has an if() conditional function

#154
post #115

Earlier quoted context omitted.

They are badly copied Ant build files. Ant came first, then when Microsoft redid the VS project format, they created MSBuild. As incredible as it may sound, Ant is still easier to deal with than MSBuild.

The legacy version of MSBuild was really bad, but the modern MSBuild project files for .NET are actually quite concise and clean by default?

Only if you are happy with defaults and don't require any build logic.

Also you forgot MSBuild is used for everything, not only .NET.

Re: CSS now has an if() conditional function

#155

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…

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

The web should always have been a programming language, with all the usual constructs available in both the display and markup layers.

But instead of a single unified standard library for the industry we got a sprawling, ludicrous mess of multiple poorly thought-out semi-compatible technologies, with an associated sub-industry of half-baked fixes and add-ons.

Re: CSS now has an if() conditional function

#156
post #131

Huh. 35 year ago I was the sole maintainer of an in-house SQL-like database query language. The application was transforming relational data into a more concise and efficient format for use in an embedded application (AT&T 5ESS digital switch). All the mapping was done in this SQL-like language. One of my power users mentioned the difficulty they had in actually changing logic based on the values in the database. For…

[dead]

Re: CSS now has an if() conditional function

#157
post #92
post #39

Earlier quoted context omitted.

They just need to start deprecating and removing old features. They had no issues with XSLT removal even when some major sites like the library of congress used it. So the excuse of backward compatability has already proven to be a lie.

Yeah. Font-size and width, be gone!

I think you mean "be gone" to only px based font-size right ? And instead of "width", use "inline-size". Instead of "height", use "block-size".

Re: CSS now has an if() conditional function

#158

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?

Because modern UI toolkits like Flutter proved that UI should just be code, not separated into three different languages. In this case, adding conditionals can remove the need for js in some cases, which is good.

Considering how this is seems to be designed... I don't think that's the reason?

I mean looking at the mdn docs it's just a replacement for regular other syntax https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/V...

So instead of having a css for x which defines e.g. dark mode and light mode separately, you can now define it via a single css rule.

Where previously the "tree" forked at the beginning and attributes were set multiple times, depending on various criteria - now you set it once, and evaluate it's value depending on criteria

    div {
      background-image: if(
        style(--scheme: ice): linear-gradient(#caf0f8, white, #caf0f8);
        style(--scheme: fire): linear-gradient(#ffc971, white, #ffc971);
        else: none;
      );
    }

It looks like simple syntactic sugar to me

Re: CSS now has an if() conditional function

#159

Earlier quoted context omitted.

That changes the width, I guess I should have specified fixed width

What is a fixed with, that is not a has not a fix value?

I mean elements with a width set in pixels, ems or some other unit. Setting width to 'fit-content' would override the width you set and then the element may overlap others to the right of it

Re: CSS now has an if() conditional function

#160

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 need unbounded recursion. Conditionals alone can’t do that. If you have some kind of conditional go to/jump if expression that’s a different matter.
Post reply on HN