3 ms·
I'm curious how mutability is meant to work e.g. in C# I might have a service that caches costly results in memory that I share across a number of other service
by Fluorescence 2y ago
I'm curious how mutability is meant to work e.g. in C# I might have a service that caches costly results in memory that I share across a number of other services operating in the same thread.
Accessing something that might update it's internal cache needs to be mutable so i) this need for mutability is viral up the call chain ii) we can't share mutable references... so it's going to be a pain in the butt and need to sidestep compile guarantees somehow. Having an out of the box best solution for common scenarios like this would be nice to see at least.
- tcfhgj 2y agoThe solution is interior mutability - the concrete solution depends on the requirements (e.g. throughput)