4 ms·
"list" in Go is not equivalent to Rust vec. List is a linked list of boxed entities. Of course they can have different types because it is a linked list; each c
by zelly 7y ago
"list" in Go is not equivalent to Rust vec. List is a linked list of boxed entities. Of course they can have different types because it is a linked list; each cell lives elsewhere on the heap. The Go equivalent to vec is an array or a slice, which does enforce the type.
As for the second example, it's more of a complaint about the library. There are libraries that enforce stricter checking. Or you can code gen or roll your own deserialization logic.
> but then the job of ensuring the sanity of the inputs is shunted to runtime rather than stopped before the code gets deployed
It's always runtime, even in Rust. You get some blob from the network to deserialize, it will return an error if it's bad, just like in Go if you try to Unmarshal bad input to a struct.
Seems like people think Rust has this magical ability to prevent errors. Big expectations lead to big disappointments.
- loopz 7y agoThe complaint about interface{} is very legit in practice. Author says he deliberately picked on Go stdlib to illustrate. I suspect one had to struggle with the same to really get it. How "stable" is Rust, libs and tooling ecosystem though.
- zelly 7y agoRust is getting better. It recently got async/await which imo is a much cleaner and undeniably faster way to do concurrency than Go's channels/CSP. It's not really fair to compare Rust's ecosystem to Go's because Rust doesn't have a trillion dollar company's halo effect. For the foreseeable future you will always be more likely to use Go than Rust at work.