context-capabilities-initiative icon indicating copy to clipboard operation
context-capabilities-initiative copied to clipboard

gather use cases

Open yoshuawuyts opened this issue 3 years ago • 2 comments

yoshuawuyts avatar Feb 18 '22 09:02 yoshuawuyts

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

matthunz avatar Feb 07 '23 09:02 matthunz

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.

NobodyXu avatar Feb 07 '23 10:02 NobodyXu