3 ms·
> Normal type systems (like C#'s) aren't Turing-complete. But it comes very very close: https://blog.hediet.de/post/how-to-stress-the-csharp-compiler https://b
by jameshart 4y ago
> Normal type systems (like C#'s) aren't Turing-complete.
But it comes very very close: https://blog.hediet.de/post/how-to-stress-the-csharp-compiler https://blog.hediet.de/post/how-to-stress-the-csharp-compile...
- CodeSgt 4y agoTypeScript's type system however is Turing complete!
- eyelidlessness 4y agoIf I remember correctly, the original issue filed about this was more of an alert than an expression of excitement. In either case the exclamation is warranted, but it’s fascinating how since then the TS type system has grown significantly more expressive in the ways it can perform arbitrary computations. You certainly could write a compile-time JSON parser or a SQL database in TS types well before template literal types, but now you can do it with the semantics of a high level scripting language (hilariously [to me] more like a lisp than either JS or TS). Gob help us if anyone bolts arbitrary IO onto the thing to bring automatic type acquisition into the fray.
- webstrand 4y agoOracle Types did just that (although it was an April Fools joke), it was quite fun to play with. https://github.com/microsoft/TypeScript/pull/43480 https://github.com/microsoft/TypeScript/pull/43480
- eyelidlessness 4y agoI genuinely love that there’s actual lisp in there. Gob help us all.
- contravariant 4y agoThough in most cases I reckon that enforcing constraints in the constructor is the right thing to do. It's not ideal, but it beats trying to write a constructive version of your program inside the type system.