4 ms·
If we could do it over, knowing that we'd eventually get to this point, would https://en.wikipedia.org/wiki/JavaScript_Style_Sheets https://en.wikipedia.org/wik
by xnx 11mo ago
If we could do it over, knowing that we'd eventually get to this point, would https://en.wikipedia.org/wiki/JavaScript_Style_Sheets https://en.wikipedia.org/wiki/JavaScript_Style_Sheets have been the better path?
- runarberg 11mo agoProbably not. There is a lot of optimizations browsers do to make the stylesheets super fast[1], and I think quite a few of those rely on CSS not being Turing complete. 1: https://hacks.mozilla.org/2017/08/inside-a-super-fast-css-engine-quantum-css-aka-stylo/ https://hacks.mozilla.org/2017/08/inside-a-super-fast-css-en...
- Sesse__ 11mo agoCSS is Turing complete :-) You can find pure-CSS implementations of Game of Life, for instance.
- cluckindan 11mo agoI don’t think that’s true, unless you count hardcoding the state evolution into CSS variables, one var per cell per step.
- runarberg 11mo agoThe 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.
- Sesse__ 11mo agohttps://propjockey.github.io/css-conways-game-of-life/infinite-edition/ https://propjockey.github.io/css-conways-game-of-life/infini... as an example. No user interaction except to start.
- runarberg 11mo agoThis 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 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.
- Sesse__ 11mo agoI haven't looked into it, but most of these tend to do clever tricks with CSS animations. https://dev.to/janeori/expert-css-the-cpu-hack-4ddj https://dev.to/janeori/expert-css-the-cpu-hack-4ddj is by the same author, IIRC, and explains some of it. 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.
- inopinatus 11mo agoIf I had a time machine I would go back and ensure that DSSSL (https://en.wikipedia.org/wiki/Document_Style_Semantics_and_Specification_Language https://en.wikipedia.org/wiki/Document_Style_Semantics_and_S...) was the standard that got up.
- runarberg 11mo agoYou write your markup in an xml syntax, your scripts in a C syntax, and your styles in a lisp syntax... a perfect trio.
- watersb 11mo agoAll hail the embedded Scheme interpreter to apply Style transformations! Although I feel like we've already explored this with XSL. The XML syntax was perhaps too much to swallow.
- bawolff 11mo agoI would say no. I think CSS is a good language and made good choices. And honestly we already essentially have this with CSS related apis in js. The examples in that article are basically identical to how you set css in js on modern web browsers with slightly different naming conventions.
- shiomiru 11mo agoI actually wonder if transpiling calc/min/max/etc. expressions to JS is a viable path to implementation, considering that you already need a fast interpreter for these.
- squeefers 11mo ago[dead]
- rcarmo 11mo agoKnowing what we know, we would probably have stepped out of our time machine to make sure that Brendan Eich kept the Scheme-based syntax and added semantic HTML enrichment for styling, sparing untold grief over the last generation...
- BrendanEich 11mo agoI don't know what "semantic HTML enrichment" means, but there wasn't time. The alternative was VBScript and DHTML. DHTML and Netscape's DOM forked Web content based on `if (document.all) /* IE code here */; else /* netscape code here */`, and only with Firefox, Opera, and Safari founding whatwg.org and start HTML5 did we unify everything.
- cestith 11mo agoIf 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.