9 ms·
Props to the implementor for sure, but I dunno, if a specification is supposed to solve a problem in a very limited niche, but can actually do something like th
by ryandvm 3y ago
Props to the implementor for sure, but I dunno, if a specification is supposed to solve a problem in a very limited niche, but can actually do something like this, I feel like the spec is actually _too_ flexible.
I feel the same way about "Quake implemented in CSS" demos. Like, very cool, but you actually should not be able to do that...
- jonahx 3y agoI believe in both cases the Turing completeness is accidental, and in the case of CSS a security concern. (In the case of TS, see https://github.com/microsoft/TypeScript/issues/14833 https://github.com/microsoft/TypeScript/issues/14833) If anyone has more historical evidence that this is so for CSS, reactions from original authors, etc, or further evidence in the case of TS, I'd be curious to see it.
- Dylan16807 3y agoSecurity concern how? Also CSS can't iterate so it's just at the level of arithmetic.
- Kinrany 3y agoAny sufficiently advanced type system necessarily becomes Turing complete because type systems generalize to full compile time programming
- IshKebab 3y agoThere isn't really any advantage of artificially limiting the power of type systems. Yes you shouldn't implement Flappy Bird in a type system... but just don't do that. This is obviously for fun.
- jlfsdlkj 3y agoIf you ever wrote any JS pre-typescript and then switched to typescript, I do not think you would call the problem "very limited niche."
- nicoburns 3y agoIf you think about it, then it makes quite a lot of sense that a type system aiming to describe the behaviour of a dynamically typed language would end up being this powerful.
- taneq 3y agoHaving recently finished I Am A Strange Loop, I'm starting to think it's harder for any formal system to not be Turing-complete than it is for it to be so.
- tshaddox 3y agoFor TypeScript I'm not really sure what you would expect them to change just to avoid being Turing complete. Its Turing completeness is a straightforward consequence of its basic building blocks: iteration, conditional types, and recursive type definitions. Of course TypeScript could go out of its way to avoid Turing completeness by just specifying a maximum recursion depth or something similar, but why?
- RussianCow 3y ago> specifying a maximum recursion depth or something similar Doesn't TS do exactly this? It doesn't seem like setting a cap on recursion depth would disqualify something from being Turing complete. Or am I misunderstanding your comment?
- explaininjs 3y agoWhen recursion is the only method of iteration, of course it would.
- smacke 3y agoIs the recursion limit an implementation detail of the compiler though, or something statically built into the language? If the former there's nothing to prevent the language itself from being Turing complete. (Similar to how every Turing complete programming language today runs on something technically weaker than a Turing machine due to finite memory.)
- explaininjs 3y agoThere’s no spec so the compiler is the language.
- olalonde 3y agoWhat is the other method of iteration? Also, TypeScript does have a recursion limit[0]. [0] https://herringtondarkholme.github.io/2023/04/30/typescript-magic/ https://herringtondarkholme.github.io/2023/04/30/typescript-...
- deleted 3y ago[deleted]
- a_wild_dandan 3y agoWhy? What benefits would we maybe gain by weakening TypeScript?
- _gabe_ 3y agoIsn’t every programming language simply a spec? C and C++ are infamous for just being a spec, with lots of undefined portions resulting in undefined behavior. And if every programming language is a spec, should we inhibit the flexibility of what you can do in them? (I think the answer here is no, but maybe there’s a good reason for limiting what you can do) Edit: Additionally, it takes very little to define a specification that leads to emergent behavior. That’s not necessarily a bad thing. It’s been awhile, but all you need for a turing machine is a way to store and read memory, and move the tape (instruction pointer) if I remember right. If that’s correct, you can come up with an infinitely complex machine with 3 instructions (provided you have an infinite amount of tape).
- n2d4 3y agoTypeScript's specification is very out-of-date. The best "specification" for the language is "whatever the compiler does." (It's a double-edged sword because it lets the TypeScript compiler move much faster than any other I've seen, but the lack of standardization regularly causes unintended breaking changes, and developing a competing-but-compatible type checker is basically impossible.)
- deleted 3y ago[deleted]