diff options
Diffstat (limited to 'posts')
-rw-r--r-- | posts/turing_complete_type_systems.md | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/posts/turing_complete_type_systems.md b/posts/turing_complete_type_systems.md new file mode 100644 index 0000000..b6ec7bc --- /dev/null +++ b/posts/turing_complete_type_systems.md | |||
@@ -0,0 +1,22 @@ | |||
1 | Rust's type system is Turing complete: | ||
2 | |||
3 | - [FizzBuzz with Rust Traits](https://github.com/doctorn/trait-eval/) | ||
4 | - [A Forth implementation with Rust Traits](https://github.com/Ashymad/fortraith) | ||
5 | |||
6 | It is impossible to determine if a program written in a | ||
7 | generally Turing complete system will ever stop. That is, it | ||
8 | is impossible to write a program `f` that determines if a | ||
9 | program `g`, where `g` is written in a Turing complete | ||
10 | programming language, will ever halt. The [Halting | ||
11 | Problem](https://en.wikipedia.org/wiki/Halting_problem) is | ||
12 | in fact, an [undecidable | ||
13 | problem](https://en.wikipedia.org/wiki/Undecidable_problem). | ||
14 | |||
15 | *How is any of this relevant?* | ||
16 | |||
17 | Rust performs compile-time type inference. The type checker, | ||
18 | in turn, compiles and infers types, I would describe it as a | ||
19 | compiler inside a compiler. It is possible that `rustc` may | ||
20 | never finish compiling your Rust program! | ||
21 | |||
22 | I understand that this post lacks content. | ||