Y
Hacker News
new
|
ask
|
show
|
jobs
by
narrowtux
3384 days ago
You could just store your modified state to new variables though
2 comments
yorwba
3384 days ago
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.
link
junke
3383 days ago
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?
link
valw
3382 days ago
Have a look at the video. Having immutable values doesn't mean you have immutable variables / names.
link
junke
3381 days ago
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.
link