This reminded me of a presentation of Martin Odersky, it's actually an example of `#4 ... But don't diabolize local state`: https://www.youtube.com/watch?v=kkTFx3-duc8#t=1128

In this case I am not sure which version is better.