I've been reading this paper (I'm actually giving a lecture on it tomorrow 0.o) and it seems like we could implement this easily. Opening this issue mostly for myself, but if someone else wants to play with it go for it.
In case you don't know what an affine type is, and I don't blame you. It's a lot like what Rust is doing staticly for example. The ability to say I guarantee that this value is only called once. A full fledged linear type system would allow to say that a value must be used, but we can't do that here. Still saying something can only be used once is extremely useful. A lot of the wins of an affine system are in resource management, with a GC a lot of these are less common. But still there are cases were you'd like to say something is only used once.
Also, and this will need thought, affine systems give you the ability to protect what's called "strong updates". Especially the ability to change the type of a value at runtime, and ensure users will only use that type. Dynamic languages like Ruby allow strong updating for everything:
# Proof
x = 1
x = "hi"
But this doesn't mean we might want to add some structure to these kinds of operations. This could however start getting outside the scope of a contract system, and into a full blown dynamic type system.
I've been reading this paper (I'm actually giving a lecture on it tomorrow 0.o) and it seems like we could implement this easily. Opening this issue mostly for myself, but if someone else wants to play with it go for it.
In case you don't know what an affine type is, and I don't blame you. It's a lot like what Rust is doing staticly for example. The ability to say I guarantee that this value is only called once. A full fledged linear type system would allow to say that a value must be used, but we can't do that here. Still saying something can only be used once is extremely useful. A lot of the wins of an affine system are in resource management, with a GC a lot of these are less common. But still there are cases were you'd like to say something is only used once.
Also, and this will need thought, affine systems give you the ability to protect what's called "strong updates". Especially the ability to change the type of a value at runtime, and ensure users will only use that type. Dynamic languages like Ruby allow strong updating for everything:
But this doesn't mean we might want to add some structure to these kinds of operations. This could however start getting outside the scope of a contract system, and into a full blown dynamic type system.