I'm somewhat amused at the bit in the Rust book where it discusses arrays. It proudly explains that Rust protects against accessing memory by stopping you from accessing elements past the bounds of an array. Apart from a tiny bit of C I don't really remember, I don't think I've ever used a language that didn't throw some sort of out of bounds error for arrays. It's good that Rust does this, but the text makes it sound like Rust is one of the few that bothers.
@alexhall I just tried a quick program with gcc/Linux and reading out of bounds of an array returned a 0 without any error. (I guess that's uninitialized memory or something.)
Rust will panic, which by default will halt the program. The Rust book is comparing with C (many would say because Rust targets programs where traditionally C would be used), so it's quite different in that regard. Although this is the behavior in many other programming languages.
@alexhall bizarre fact I always love to mention. In C, a[b] is nearly exactly the same as b[a], because indexing into an array is adding the index to the memory address, and addition is conmutative.
C is raw in most regards. Rust adds bounds checks. Which means by default array access is a tad slower in Rust. But what might cause a problem in C will halt a Rust program instead of doing bizarre, possibly harmful stuff.
@coder I've used only a very small amount of C. My daily language is PHP, and I'm comfortable in JS and Python. I am familiar with a few other languages, but not enough to do much with them without some research. I'm probably not the primary audience for Rust, having never had to worry about the low-level access C offers.
@alexhall yeah, that's completely fine. Rust has many niceties that are uncommon in other languages, so Rust fans reach for it even when they don't need low-level features... but it's still a bit painful if you're not very good with it.
Most software I work with is better done in Java/Python/etc.