3 ms·
The point is that the language has decided that some kinds of builtin operations can panic, in the interest of developer ergonomics. The alternative is that eve
by defen 3y ago
The point is that the language has decided that some kinds of builtin operations can panic, in the interest of developer ergonomics. The alternative is that every indexing operation returns a Result, or you write 4 lines of code instead of 1 for every indexing operation. So the notion that the programmer should never write "panic!" in their code does not fully address the underlying problem, if the reason for not writing "panic!" is "library code should never panic".