Nonlocal and nonglobal fns (and a few other things)


I would love it if we could define nonlocal and nonglobal fns:

nonlocal fns can only access globals (and are trait-object-unsafe). tbh this isn’t really required as it’s mostly already a thing through other means
nonglobal fns can only access locals (and are trait-object-safe) - useful for getters

and additionally, I’d like to see opaque self reference fns - they’re trait-object-safe and can inspect the stuff around the fat pointer, like the vtable (for trait objects) and length and stuff, but cannot dereference the fat pointer (or call functions that do so). as such, they’re useful for getting access to globals in a trait-object-safe manner. see things like the eventbus crate.


closed #2

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.