Description
Currently, promise resolution more than once triggers and assertion, that should be changed and trigger a proper SOMns exception.
Promise cannot be resolved multiple times, and we should not allow silent erroneous resolution and potential unmitigated race conditions.
Doing this with the current promise and resolver design might be broken.
We need to make sure that a loop inside an actor cannot observe the promise being resolved by another actor in a racy manner.
In vats, it is possible that a resolution is triggered in the same actor multiple times, so, it is natural to have the desire to check whether a promise has been resolved. However, this might be racy.
I think, I don't remember exactly, that resolvers a shared as values between actors, so multiple actors might be able to resolve the same promise.
This means, we might need to make promise resolution asynchronous. So, we might need to have something like resolver resolve: [:alreadyResolved | #valueToBeUsedIfNotAlreadyResolved ]
.
This smells like headache...
Needs further thought and perhaps a different design. Perhaps resolvers should always be far references. And it should be (resolver <-: resolve: value) whenResolved: [:resolutionSuccessful | ... ]
. Still not very convincing. In AT, everything was done via messages and futures are a library anyway. Hm...