You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.
Could you elaborate on whether functional purification can still hold when using types with interior mutability, like 'Cell'?
In the following example, c2 is mutated through c1. Is there any rule that can be used to transform this into a purely functional equivalent (without having to track all the aliases to c1, which might be difficult for non-trivial cases)?
let c1:&Cell<i32> = &Cell::new(0);let c2:&Cell<i32> = c1;
c1.set(2);println!("{:?}", c2.get());// Prints 2
What about RefCell, Mutex, ... ?
The text was updated successfully, but these errors were encountered:
Yes, types with interior mutability are outside the thesis' language subset a priori. Some of them like Rc could still be modeled in a referentially transparent way as long methods like try_unwrap that expose the mutable state are not exposed. For all other types, you would have to introduce a global heap and presumably reason about it using separation logic. My hope is that this would still be simpler than other models that use separation logic for every single type, but this was out of scope for the thesis.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Could you elaborate on whether functional purification can still hold when using types with interior mutability, like 'Cell'?
In the following example,
c2
is mutated throughc1
. Is there any rule that can be used to transform this into a purely functional equivalent (without having to track all the aliases toc1
, which might be difficult for non-trivial cases)?What about RefCell, Mutex, ... ?
The text was updated successfully, but these errors were encountered: