Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Maybe if you think of [] as offsetting a pointer rather than calling into an Index (or IndexMut) implementation. Since the return type isn't optional, a panic is the only way to avoid performing an invalid access or manufacturing an unfaithful return value. There are also optional accessors which do not panic, and unsafe/unchecked accessors.


Maybe? I think my statement is clearly correct in the way I formulated it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: