3 ms·
That's a nice way of introducing type state programming in an affine programming language! In general though, type state programming would be even nicer in a l
by fmap 8y ago
That's a nice way of introducing type state programming in an affine programming language!
In general though, type state programming would be even nicer in a linear language. For example, in the http server I could start writing a response without ever writing a body. Rust would happily accept this code, because Rust is always allowed to throw away resources.
An affine language controls the duplication of resources, while a linear language controls both duplication and destruction of resources. In a linear Rust, a data structure would have to implement Drop in order to be silently deleted and in the http server "HttpResponseWritingHeaders" should not implement Drop.
- deleted 8y ago[deleted]