Rust's type system is Turing-complete (2017)
sdleffler.github.io
Rust's type system is Turing-complete (2017)
1–10 of 91 posts
Re: Rust's type system is Turing-complete (2017)
#2Rust's Type System Is Turing-Complete: Type-Level Programming in Rust - https://news.ycombinator.com/item?id=13843288 - March 2017 (117 comments)
Re: Rust's type system is Turing-complete (2017)
#3Re: Rust's type system is Turing-complete (2017)
#4It’s important to understand that this is a big problem. If a type system is Turing complete, than it either has to be inconsistent or incomplete. In other words it either must allow type invalid programs through, or it must prevent some type valid programs (or both!).
I'm specifically not talking about something like Typescript which is widely known to be unsound, but a type system that was believed to be "safe" before someone figured it is Turing complete.
Re: Rust's type system is Turing-complete (2017)
#5It’s important to understand that this is a big problem. If a type system is Turing complete, than it either has to be inconsistent or incomplete. In other words it either must allow type invalid programs through, or it must prevent some type valid programs (or both!).
edit: by which I mean, the theoretically defined type system, not the actual program implementing it.
Re: Rust's type system is Turing-complete (2017)
#6Re: Rust's type system is Turing-complete (2017)
#7It’s important to understand that this is a big problem. If a type system is Turing complete, than it either has to be inconsistent or incomplete. In other words it either must allow type invalid programs through, or it must prevent some type valid programs (or both!).
Aren't such programs not very interesting by definition?
And why would you call them "valid" programs?
Re: Rust's type system is Turing-complete (2017)
#8It’s important to understand that this is a big problem. If a type system is Turing complete, than it either has to be inconsistent or incomplete. In other words it either must allow type invalid programs through, or it must prevent some type valid programs (or both!).
I don't see how this is the case. The type system being Turing complete just makes it undecidable, ie. it's not guaranteed to finish type checking. In a way you could call that "preventing some type valid program", though I wouldn't consider an infinite loop of types valid.
Re: Rust's type system is Turing-complete (2017)
#9To me the main takeaway of results like this is: you're already paying the full price of using whatever complicated type system feature you care to name. So I have limited sympathy for people who are scared of the complexity of, say, higher-kinded types, or dependent types, or kind polymorphism. Your type system is already as complicated as possible, adding more features won't make it more Turing-complete - rather, m…
Re: Rust's type system is Turing-complete (2017)
#10It’s important to understand that this is a big problem. If a type system is Turing complete, than it either has to be inconsistent or incomplete. In other words it either must allow type invalid programs through, or it must prevent some type valid programs (or both!).
How is Turing-completeness related to soundness? I am behind on CS theory, but what little I know about category-theory tells me this isn’t the case.