News for hackers. Stuff that matters.
Re:Rusty Typestates – Starting Out by nllsh on Friday December 03, 2021 @04:32PM (#29435830)
I just read about typestates in Rust on Cliff Biffle's blog here: http://cliffle.com/blog/rust-typestate/#variation-state-type...

He covers a few additional parts of the typestate pattern, such as isolating data in specific states as well as sharing common implementations across a subset of states.

I'd also like to note that typestates also show up in functional programming under Indexed Monads, where a function might take a struct from an initial typestate, unwrap its data, and return a final(likely different) typestate. You can search Indexed Monad for more explanation there. If you work primarily in typescript you can find a production ready implementation of typestate programming here: https://github.com/DenisFrezzato/hyper-ts

There are no comments on this comment yet.