Has anyone tried an RFC on adding capabilities to Rust? BTW, not sure if I'm using the right PL term. By capabilities, I mean the ability to explicitly allow or deny certain "capabilities" such as allocating, panicking, etc. Basically something along the lines of:
fn foo() -> Vec<u32> without alloc {
Vec::new()
}
fn foo() -> Vec<u32> without alloc {
let v = Vec::new();
v.push(0); // Compiler error because `push` is marked as `with alloc`
v
}
Thanks! Searching for "Rust language effects" brings up a ton of results. Most of them seem to be focused on control flow rather than don't panic/allocate though which is a bit of a bummer.
Yup, I saw that but it's more focused on threading contexts through the call stack (aka DI). Then again, if allocating or panicking were only accessible via a context, I think that's the same as having an effect that allows or denies allocation/panics.