Re:An introduction to type programming in TypeScript
by jcelerier on Wednesday February 02, 2022 @08:59AM
(#30177560)
Thanks but I'll take the ability to write arbitrarily complex type-checks over anything else. As a C++ dev who goes out of his way to express things of the type system this has only ever been a positive for me, the loss in compile-time is more than offset by the ability to eliminate whole classes of bugs in one go.
Re:An introduction to type programming in TypeScript
by bmc7505 on Monday February 07, 2022 @08:46PM
(#30253999)
If you want arbitrarily complex type-checking, why not just check the property you want at runtime instead using an esoteric typelevel programming language? The whole point of having types in the first place is provable decidability, not universal computation -- that's what the value-level is designed to do.
Re:An introduction to type programming in TypeScript
by gpderetta on Wednesday February 02, 2022 @04:45AM
(#30175558)
Which widely used statically typed languages do not have a Turing complete type system? C, probably Go?
Re:An introduction to type programming in TypeScript
by ReleaseCandidat on Wednesday February 02, 2022 @05:00AM
(#30175667)
Depends on your definition of 'widely used' ;).
Using Tiobe's top 20: I'd guess Swift, Delphi, Fortran and Go
C++, Java, Rust, Haskell, Typescript have a Turing complete type system. C#: don't know, could be.
Re:An introduction to type programming in TypeScript
by gpderetta on Wednesday February 02, 2022 @05:53AM
(#30175992)
Of the list above, I'm most surprised that Swift doesn't have a Turing complete type system.
Re:An introduction to type programming in TypeScript
by ReleaseCandidat on Wednesday February 02, 2022 @06:56AM
(#30176383)
I wanted to answer with "because Swift's type checking is decidable", but that has changed (with SE-0142 and SE-0157) - allowing recursion. So, it is 'at least' undecidable now.
https://forums.swift.org/t/swift-type-checking-is-undecidabl...
GitHub issue about the Turing completeness:
https://github.com/microsoft/TypeScript/issues/14833
Proof of Turing completeness:
https://gist.github.com/hediet/63f4844acf5ac330804801084f87a...