Live data from Hacker News

CSS now has an if() conditional function

caniuse.com

131–140 of 245 posts

Re: CSS now has an if() conditional function

#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 example, to perform different logic based on whether a column was a 1 or a 2, they'd have to write two querys: one for 1 and another for 2. Possible, sure, but not very clean or efficient. To address this, I implemented an if() function.

Re: CSS now has an if() conditional function

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

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

> As as lisp programmer, I love it.

You make bad engineering decisions because you consider the advantages, but not the disadvantages. https://news.ycombinator.com/item?id=29231493>

Re: CSS now has an if() conditional function

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

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

Re: CSS now has an if() conditional function

#136
post #61
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.

This is so true, I have seen it happen with so many projects. It always starts with a cute declarative DSL, and inevitably imperative / flow control structures emerge, at which point you wonder why they didn't use a real programming language in the first place and save you the hassle or learning a half baked imperative DSL. - Puppet - CMake - Terraform - ... All these started with pure declarative DSL then incrementa…

I think cmake kind of needs conditional checks though.

Re: CSS now has an if() conditional function

#137
post #61

Earlier quoted context omitted.

This is so true, I have seen it happen with so many projects. It always starts with a cute declarative DSL, and inevitably imperative / flow control structures emerge, at which point you wonder why they didn't use a real programming language in the first place and save you the hassle or learning a half baked imperative DSL. - Puppet - CMake - Terraform - ... All these started with pure declarative DSL then incrementa…

- Visual Studio project files are XML files that are interpreted line by line, and can contain variables, branches, and loops. Hell on earth.

Wesnoth the game also has that via WML. Looks very ugly and obfuscated.

Re: CSS now has an if() conditional function

#138
post #115

Earlier quoted context omitted.

- Visual Studio project files are XML files that are interpreted line by line, and can contain variables, branches, and loops. Hell on earth.

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.

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.

Re: CSS now has an if() conditional function

#139

Earlier quoted context omitted.

You have to give it to CSS, it's held out for a lot longer than most.

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?

Re: CSS now has an if() conditional function

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

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.
Post reply on HN