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…
> 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.
CSS now has an if() conditional function
231–240 of 245 posts
Re: CSS now has an if() conditional function
#232Give 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…
Re: CSS now has an if() conditional function
#233Earlier quoted context omitted.
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 int…
> The formal definition (simplest) of Turing Machine is simply a tuple of states set, symbol set, initial state, accepting states set and a transition function. There is no crank in it. By computation we mean somebody needs to apply the transition function faithfully on the tape which is exactly like the clicking in this case. More formally, a model of computation can be viewed as a set of rules somebody needs to follow to do the computation. In that sense, I think CSS is Turing-Complete.
There is even a "CPU emulation" in pure CSS: https://dev.to/janeori/expert-css-the-cpu-hack-4ddj and pure CSS fetch: https://dev.to/janeori/100-css-fetch-and-exfiltrate-512-bits...
Re: CSS now has an if() conditional function
#234Earlier quoted context omitted.
You can do without javascript. Checkbox `:checked` + `label` trick for toggling states still works. See: https://codepen.io/abdus/pen/bNpQqXv
Thanks, I’ll check this out!
Re: CSS now has an if() conditional function
#235Earlier 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
Re: CSS now has an if() conditional function
#236Earlier quoted context omitted.
CSS is Turing complete :-) You can find pure-CSS implementations of Game of Life, for instance.
The implementations I have seen rely on the inclusion of HTML form elements, and a manual step to update the state. So in that sense CSS + HTML + User Interaction is Turing complete. But that is a different language then CSS, even if a part of that language happens to be written in CSS.
Re: CSS now has an if() conditional function
#237Here is a much better link to how it works: https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/V...
padding: 1em; padding: if(style(--size: "2xl"): 1em; else: 0.25em); > Note: Remember to include the else condition. In if()-supporting browsers, if no else value were included and --size was not equal to "2xl", the padding would be set to initial. This is counterintuitive. You would expect the above falls back to "1em" (from "padding: 1em;") when "else" is not specified. Instead, omitting "else" apparently means "els…
padding: 1em;
padding: var(--padding);
With no fallback value that resolves to padding: unset if the variable is not defined. The only ways I know of to work around this are style queries: padding: 1em;
@container style(--padding) {
padding: var(--padding);
}
Or cascade layers: @layer base {
padding: 1em;
}
@layer override {
padding: var(--padding, revert-layer);
}Re: CSS now has an if() conditional function
#238Earlier quoted context omitted.
The implementations I have seen rely on the inclusion of HTML form elements, and a manual step to update the state. So in that sense CSS + HTML + User Interaction is Turing complete. But that is a different language then CSS, even if a part of that language happens to be written in CSS.
https://propjockey.github.io/css-conways-game-of-life/infini... as an example. No user interaction except to start.
EDIT: For the record, while I am very impressed, and this is a wonderful work of art we can all enjoy, I am not convinced this is proof of the Turing completeness of CSS. At most this would prove that CSS + HTML is Turing complete (which still better then CSS + HTML + User instructions in natural language). But I wonder if in these 43000 lines of CSS the entire state space was encoded (with some clever compression obviously), and I am not sure if that would count as proof of Turing completeness.
Re: CSS now has an if() conditional function
#239Earlier quoted context omitted.
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.
Disagree. The newer stuff is, if anything, more confusing. The old stuff, awful as it was, at least had a consistent model.
Re: CSS now has an if() conditional function
#240Earlier quoted context omitted.
https://propjockey.github.io/css-conways-game-of-life/infini... as an example. No user interaction except to start.
This is impressive. 43000 lines of CSS. Do you know how this works? EDIT: For the record, while I am very impressed, and this is a wonderful work of art we can all enjoy, I am not convinced this is proof of the Turing completeness of CSS. At most this would prove that CSS + HTML is Turing complete (which still better then CSS + HTML + User instructions in natural language). But I wonder if in these 43000 lines of CSS…
CSS alone is not Turing-complete (AFAIK), because you don't have anywhere to attach state (the computed style) if you don't have a DOM and loops are generally prohibited. But CSS exists literally only to style a DOM, so I don't consider that all that much of a concession.