Hacker News new | ask | show | jobs
by def-lkb 1610 days ago
> having the circle not reset after every color change is probably not feasible unless the module order is fairly convoluted right?

Not necessarily no. The thing is that you could have an early module that implements a framework to manage state. For the circle rotation, it is quite easy, it is a single number. You could do something like:

`let circle_rotation = managed_state "circle_rotation" Float 0.0`

"The rotation of the circle is represented by a float initialized to 0". Then even when your module is reloaded, the hypothetical framework takes care of preserving this piece of state.