Answer the question
In order to leave comments, you need to log in
Why is Immutable good for js?
In present time, everywhere talks about the so-called immutability and how cool / cool / and how_we_lived_without_it_in general, arguments such as:
More scope for compiler optimization,
Simplification of life for tools for static code analysis,
Simplification of tracking changes in data structures ,
Avoiding many so-called side effects in functions,
(one of the main advantages) Non-blocking reading from different threads, etc.
But:
In JS, there is only one thread of execution.
Side effects!? Are they really fully solved by using .. immutable data?
A separate ambiguity arises about "optimization by the compiler": is it possible that some purely artificial idea, alien to the language in question, can contribute to some kind of optimization?
And all this would be more or less tolerable if the data were really immutable, but, albeit indirectly, they are subject to change (to the word about setIn in immutable).
Where does one big question come from: why come up with hemorrhoids unnatural for JS in the form of immutable data, drag a separate thick file into the project just for this, so that .. still change the data, but instead of economically changing one element, copy the entire array with .. every time. with a single changed element (or even one of its fields) and, it would seem, where does the saving of memory and computing power of the processor come from?
Why is immutability in JS so good that it justifies such a tangible overhead with rather vague positive features?
Answer the question
In order to leave comments, you need to log in
I thought the main plus is not in this, but in the fact that you can track the change in the object.
I liked the report on this topic https://www.youtube.com/watch?v=8BExyeds_c0
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question