The goal is to be able to express the effects that a function may (or may not) have in a static way that the compiler can check. Possible effects include task failure, code marked "unsafe", garbage collection, dynamic allocation in general, file I/O, nondeterminism, task rescheduling, and mutation outside of one's own stack frame. There could also be the ability to add custom user-provided, domain-specific effects (that don't depend on language primitives).
To be feasible for Rust, an effect system will have to be:
- Unobtrusive. A user who doesn't care about effects in their code should not have to write any effect annotations.
- Lightweight. When used, effect annotations should be clear in meaning and not need to refer to other effects which aren't relevant.
- Polymorphic. The system must express a higher-order function's effect depending on the effect of its argument closure. Otherwise that function would have to be assigned the top effect which would make it impossible to use anywh