4 ms·
Obvious question: are CSS functions Turing complete?
by ape4 1y ago
Obvious question: are CSS functions Turing complete?
- est 1y agoI remember there's expression() on IE6.
- csswizardry 1y agoWay ahead of its time. Unfortunately.
- zamadatix 1y agoCSS Custom Functions are defined in a way they don't add anything over traditional CSS in this regard. I.e. they are just allowed to act as custom functions - not recursion mechanism, jump mechanisms, loop mechanisms, etc.
- Sesse__ 1y agoThey are not allowed to loop or recurse, so no, by themselves, they are not (unless you accept repeating the function a potentially infinite amount of time). CSS in general is Turing complete if you allow running multiple frames, although it requires ugly hacks. See e.g. https://codepen.io/propjockey/pen/dywNyBQ https://codepen.io/propjockey/pen/dywNyBQ, which is quite insane IMO.
- qingcharles 1y agoStupider question: how long until it can run Doom?
- cluckindan 1y agoNo. The implementation treats the function body as just another CSS rule set, which is applied to some virtual element. The ”result: somevalue;” rule then sets the ”result” style property on that element, and that property value gets plopped onto the call site. Kinda clever, actually.