4 ms·
> In the end I want fast compile times, type safety, easy to maintain code and good error messages. I do not care if the type system is Turing Complete. I thin
by 38 3y ago
> In the end I want fast compile times, type safety, easy to maintain code and good error messages. I do not care if the type system is Turing Complete.
I think the problem is some languages with Rust go too far with generics, which probably triggers the turing complete. for example, this is valid Rust code:
let mut handles = Vec::new();
for i in 0..10 {
let handle = do_work(i);
handles.push(handle);
}
but you have to follow the code all the way to "do_work" before you ever find the type of anything. Go does not allow this. you need to either declare a concrete type:
var handles []int
or a explicit generic type:
type slice[T any] []T
var handles slice[int]
I think Rust is lose lose, because the underlying type implementation is Turing complete, and I would argue the code is actually less readable because of the overuse of type inference.
- bhouston 3y ago> I think Rust is lose lose, because the underlying type implementation is Turing complete I am not a Rust coder so I can't really comment. Currently, I do TypeScript, which also has a Turing complete type system, and I love it. Of course all things in moderation. Even though I could make a completely obtuse type design for projects, I try to not write code that others can not understand.