Hacker News new | ask | show | jobs
by christophilus 3223 days ago
I think REPLs work better in languages that provide 1st class immutability support, since it's easier to set up state once, then play with functions without having to re-set up state every time you tinker.
1 comments

I think REPLs work better in languages that don't provide 1st class immutability support, since it's easier to change state, then play with functions without having to re-set up state every time you tinker.
You could just store your modified state to new variables though
Or you could just make copies of state you want to keep before mutating it. Both mutable imperative code and immutable functional code can emulate each other, so which one to choose largely depends on your preferences.
In a live-coding session, how does the existing, running code knows that it should look at the new variables instead of the old ones?
Have a look at the video. Having immutable values doesn't mean you have immutable variables / names.
I know, the parent post was saying "you could just store your modified state to new variables", not replace what existing variables are bound to.