6 ms·
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
by lgas 11y 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 https://github.com/sebmarkbage/ecmascript-rest-spread
They will be neither immutable nor persistent.
- HeyImAlex 11y agoPoster probably meant it makes writing non-mutative code easier. Never mutating by convention is how a lot of js is being written these days.
- jaredly 11y agoright. should have "(by convention)" in there. unfortunately not (yet) language enforced.
- lgas 11y agoAh. Guess that makes sense. I'm lucky enough to be able to use ClojureScript so I guess I've fallen behind on modern JS.