In pollFor and triggerOrAdd the current.res is repeatedly wrapped in new NewOutcome(_). This is costly in terms of runtime and in terms of memory.
One could have IntermediateState.res of type NextOutcome[V] and always store NextOutcome(v). Than this unique object could be passed around.
In pollFor and triggerOrAdd the current.res is repeatedly wrapped in new NewOutcome(_). This is costly in terms of runtime and in terms of memory.
One could have IntermediateState.res of type NextOutcome[V] and always store NextOutcome(v). Than this unique object could be passed around.