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

Technically yes, there are trapdoors like RefCell. But these are intended to be used sparingly because they move all relevant borrow-checks to runtime. Under normal circumstances immutability is statically guaranteed by the ownership system, which is much more than can be said for other languages where mutability is an option at all.


I suspect lifetimes get you the vast majority of the benefit of immutable data for UI purposes, tbh. It lets you ensure that references aren't retained or accessed at the wrong time, unless they provide an explicit way to bypass that (i.e. the defaults for data types is safe).




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

Search: