Hacker News new | ask | show | jobs
by lgas 3854 days ago
The post says:

  In javascript, everything is mutable, but w/ new es7
  spread/rest syntax it is increasingly easy to just do
  immutable anyway. E.g. instead of myobj.x = newx you can
  do myobj = {...myobj, x: newx} and everything is immutable
  & persistant!
But if I'm reading this right:

https://github.com/sebmarkbage/ecmascript-rest-spread

They will be neither immutable nor persistent.

2 comments

Poster probably meant it makes writing non-mutative code easier. Never mutating by convention is how a lot of js is being written these days.
right. should have "(by convention)" in there. unfortunately not (yet) language enforced.
Ah. Guess that makes sense. I'm lucky enough to be able to use ClojureScript so I guess I've fallen behind on modern JS.