3 ms·
Not used Clean, but it sounds interesting. What i'd love is an imperative language where you declare what effects a method can have and the compiler enforces t
by quickthrower2 7y ago
Not used Clean, but it sounds interesting.
What i'd love is an imperative language where you declare what effects a method can have and the compiler enforces them. E.g. if it promises not to mutate any parameters, it can only call functions that make the same promise etc.
- malvosenior 7y agoThat sounds very similar to Rust. Mutations and even memory lifetime are specified in the type system.
- brabel 7y agoThis is how Pony does it, basically. See [Reference Capabilities](https://tutorial.ponylang.io/reference-capabilities.html https://tutorial.ponylang.io/reference-capabilities.html).
- cinnamonheart 7y agoIdris isn't imperative (Haskell-like with dependent types), but offers features like those: http://docs.idris-lang.org/en/latest/effects/depeff.html http://docs.idris-lang.org/en/latest/effects/depeff.html readInt : Eff Bool [STATE (Vect n Int), STDIO] [STATE (Vect (S n) Int), STDIO] http://docs.idris-lang.org/en/latest/st/machines.html http://docs.idris-lang.org/en/latest/st/machines.html logout : (store : Var) -> ST m () [store ::: Store LoggedIn :-> Store LoggedOut] They're both implemented within Idris, as libraries/modules, rather than being compiler magic: - https://github.com/idris-lang/Idris-dev/blob/master/libs/contrib/Control/ST.idr https://github.com/idris-lang/Idris-dev/blob/master/libs/con... - https://github.com/idris-lang/Idris-dev/blob/master/libs/effects/Effects.idr https://github.com/idris-lang/Idris-dev/blob/master/libs/eff... I think it'd be possible to write similar effect systems in other dependently typed languages like ATS, which is a relatively imperative language (C+ML-like).