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?
(Similar to how every Turing complete programming language today runs on something technically weaker than a Turing machine due to finite memory.)
[0] https://herringtondarkholme.github.io/2023/04/30/typescript-...
Iteration (loops) are typically represented as jump or branch instructions while recursion requires the creation of a new stack frame on the call stack.
That sounds like a reasonable resolution.
type MultiDimArray<T> = T[] | MultiDimArray<T>[];
type LinkedList<T> = {
value: T,
next: LinkedList<T> | null,
};
type Json = string | number | null | Json[] | { [k: string]: Json };JavaScript taxes interface complexity through increased cognitive load. Typescript frees developers from that tax and harms architecture in the process.
Funny how business gurus keep saying over and over that incentives are everything and yet when it comes to choosing developer tools for their businesses, they choose tools which promote terrible incentives, instead they choose "that which sounds good"... It's like communism. It sounds good in theory but it fails spectacularly at the incentive layer... It fails at the most important layer.
This isn't theoretical; the only reason TypeScript allows for such complex interfaces is precisely because JavaScript devs have created those interfaces, and TypeScript makes a best-effort to make as much JS code type-able as possible.