Hacker News new | ask | show | jobs
by dragonwriter 4130 days ago
One way is to use local mutable state within functions that are implemented so as to be not rely on external state, which are then indistinguishable to calling code from pure functions.
1 comments

Yes, that's what I had in mind.

If only there was an effect system that could guarantee purity and at the same time not be in the way (i.e. allow full or Scala-like type inference). Then purity would be guaranteed by types, like it is in Haskell. (N.B. I'm not asking for Haskell's purity by default. I advocate impure as default, with a type guarantting purity.)