3 ms·
This is an incredible basic article, and there's a lot of issues with it to boot which is surprising considering the author has performed talks at Go conference
by thegeekpirate 7y ago
This is an incredible basic article, and there's a lot of issues with it to boot which is surprising considering the author has performed talks at Go conferences:
Go's equivalent to Rust's Vec should have simply been []int64 instead of using list.List (which is a doubly-linked list, aka std::collections::LinkedList in Rust). And yes, I read the blurb at the end where they say they know slices exist. The issue is that they proved nothing useful by not using them. You don't need to recreate how slices work because _they already exist_, and is well-known it's all currently compiler magic (until they introduce generics).
In the JSON unmarshalling example, the reason you need struct tags in Go is because the JSON field name is different from the one given in the Go code. You'd have to do the exact same in Rust if they had named it similarly to the Go example (https://serde.rs/field-attrs.html https://serde.rs/field-attrs.html).
The other stuff about catching concurrent issues is true, but working with concurrency in Rust is a testament to one's patience as well (especially when working with multiple processes/threads), so you're trading off usability with safety—and to be frank, it's pretty easy to remember that the only things that work concurrently are either atomic, use locks, or some sort of queue.