context-capabilities-initiative
context-capabilities-initiative copied to clipboard
gather use cases
- mock the time source for testing in an async code base
- mark a thread as being "the UI thread" #7
If we can nest contexts (as in set them in a child context and pop them off when we get to a sibling function) this would be great for function scope!
For example how Jetpack Compose use's a RowScope
in UI
One example that I heard of (but not used) is passing around tokens of ghost-cell, singleton cell, combined with capability, writing code that need multiple aliases but not active at the same time will be much easier to write.
I also heard that one single-thread async runtime also passes ghost-cell token to future so that multiple fut can store alias to the same variable but without using RefCell/Rc.
This also sounds very useful since future by its very nature, relinquishes the alias when pending.
This could be also useful for generators in general to avoid RefCell/Rc.