There's one scenario I find interesting:
final class X {
private var state = ...
func random() -> Int {
synchronization.sync {
// mutate state
return randomNumberBasedOnState
}
}
}
There's no reliance on X
being unique, and we'd perceive the same behaviour (i.e. random) whether or not X
is called from the other class. For all intend and purpose, using X
here does reason like what you'd expect of value semantic.