[rust-dev] Why doesn't rust require "mut" param prefix at call site?

Stefan Plantikow stefan.plantikow at gmail.com
Fri Jan 3 02:25:48 PST 2014


Hi,

Am 02.01.2014 um 07:18 schrieb Patrick Walton <pcwalton at mozilla.com>:
> 
> 
> And that's just a simple example: start throwing in existential types like traits and it becomes clear that you really can't tell from the program where mutation could possibly happen, because the types are hiding mutability from you. And that's fine--existential types and generics deliberately permit that abstraction. But it does mean, I think, that we can't meaningfully talk about a sound and complete "mut" annotation at call sites.
> 

Maybe completely off here but why is mutability not tracked by the region system? Wouldn’t that help solve this issue? i.e. assignment to a mutable lvalue would only be allowed from an rvalue in a mutable region.   Haven’t thought about how that relates to freezing/thawing.


Cheers,


Stefan




More information about the Rust-dev mailing list