2 ms·
People have written drafts of a design for this for Rust. Calling it capabilities.
by keybored 4y ago
People have written drafts of a design for this for Rust. Calling it capabilities.
- dymk 4y agoAs a part of the language standard / standard library, or as a third party crate? I'm confused how this would work, as as far as I'm aware, making this a language-level feature would require significant changes to the ethos of the language. There are some examples, e.g. the Bevy ECS doing more or less dependency injection for you (and ensuring against things like aliased mutable references), which is pretty neat.
- keybored 4y agoPart of the language https://tmandry.gitlab.io/blog/posts/2021-12-21-context-capabilities/ https://tmandry.gitlab.io/blog/posts/2021-12-21-context-capa...
- dymk 4y agoFascinating. Not sure what my opinion is of it yet. Reminds me of implicit parameters in Scala - https://docs.scala-lang.org/tour/implicit-parameters.html https://docs.scala-lang.org/tour/implicit-parameters.html Edit: I think I like it. It doesn't solve dependency injection like e.g. Guice but the examples given, e.g. providing implementations for traits defined in external crates that take arbitrary state, is compelling.