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

No, Rust has pointer arithmetic, though it's bounds checked with slices. The restriction is that two mutable references cannot point to the same location. This is enforced by the borrow check: http://pcwalton.github.io/blog/2013/01/21/the-new-borrow-che...


At compile time or run time?


Bounds checked at runtime (unless you use the unsafe sublanguage). Without dependent types (which I feel would exceed our complexity budget) we can't do much better.

However, for simple iteration, if you use iterators idiomatically instead of C-style for loops then you won't incur any bounds checks.


I was just about to accuse you of dependent typing.


Thanks!




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

Search: