Rust protects you from doing stupid things via an ingenious mechanism.
I found it interesting that if I try to print something completely out of bounds, it compiles just fine, and panics at runtime.
I would have thought that if it knows the String length at compile time it would have a compile error...
Absolutely, I would have thought so too. Apparently this is one of the objections people make to Rust, that it just crashes all the time. At least the crashes are for deliberate reasons and not due to some memory fault.
I found it interesting that if I try to print something completely out of bounds, it compiles just fine, and panics at runtime.
I would have thought that if it knows the String length at compile time it would have a compile error...
Absolutely, I would have thought so too. Apparently this is one of the objections people make to Rust, that it just crashes all the time. At least the crashes are for deliberate reasons and not due to some memory fault.