Hi rust-dev, I've been thinking about how an "effect system" would work in Rust, in which we could statically reason about the effects that functions can or can't have. Such a system would let you say "compiler, please make sure that failure (or some other effect, such as GC) can't occur during this function".
There are some obvious benefits (banning failure in destructors, which is currently unsound) and some obvious big issues (should 'assert' be considered to fail? how do we reason about garbage-collected destructors with arbitrary effects being invoked whenever GC can happen?). I have drafted a proposal, which outlines a flexible + lightweight syntax for annotating effects, and goes into detail about the issues: https://github.com/mozilla/rust/wiki/Proposal-for-effects Please weigh in if you have opinions about: - why it would be great to have in the language (what's your use case?) - why it would be terrible to have in the language (how do you see it getting in the way of users who don't want to worry about effects? do you see any of the issues I outlined as show-stoppers?) - theoretical issues about not being able to infer, and having to require user annotations, in certain situations - how you think my proposed syntax could be better If we collectively decide that an effect system would be welcome in Rust, I'd be happy to pursue it as my summer project for the next 10 weeks. Ben _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
