3 ms·
> but it's not true of generics in most languages not sure how true that is. * TypeScript: https://github.com/microsoft/TypeScript/issues/14833 https://github
by wk_end 5y ago
> but it's not true of generics in most languages
not sure how true that is.
* TypeScript: https://github.com/microsoft/TypeScript/issues/14833 https://github.com/microsoft/TypeScript/issues/14833
* Rust: https://sdleffler.github.io/RustTypeSystemTuringComplete/ https://sdleffler.github.io/RustTypeSystemTuringComplete/
* Haskell (GHC): https://mail.haskell.org/pipermail/haskell/2006-August/018355.html https://mail.haskell.org/pipermail/haskell/2006-August/01835...
* Scala: https://michid.wordpress.com/2010/01/29/scala-type-level-encoding-of-the-ski-calculus/ https://michid.wordpress.com/2010/01/29/scala-type-level-enc...
* Java: https://arxiv.org/abs/1605.05274 https://arxiv.org/abs/1605.05274
- naasking 5y agoMost of that cleverness requires generics + something else, usually some kind of subtyping. This is the case at least for Java, Haskell, Scala and Rust. Generics alone typically do not admit Turing complete expressions. In Zig and dependently typed languages where types are ordinary values, you typically have the regular looping/recursion available, and so Turing completeness follows naturally unless you take steps to mitigate this. Zig makes a hard distinction between runtime and comptime which might solve this, and dependently typed languages have termination checkers which extend this sort of distinction in more flexible ways.