3 ms·
I'm an outsider to the JS world but find it absolutely fascinating the direction the language has taken. It's clear that a lot of the new language features enab
by dpwm 8y ago
I'm an outsider to the JS world but find it absolutely fascinating the direction the language has taken. It's clear that a lot of the new language features enable more concise functional programming. I see this as a good thing.
I'm really surprised that whilst the language on the one hand gives nice tools like the object spread syntax, the last time I checked it didn't make it easy to make the interpreter enforce immutability.
It seems strange to me that the language evolves in this way to recognise foot-guns but doesn't give you the tools to turn them off. Object.freeze looked like it would do the trick, but it's shallow. Freezing doesn't survive the spread syntax, which makes perfect sense because it freezes the original object, and of course the whole point of immutable objects is to create a new object.
It feels like you're able to program in this style, but the language designers didn't really consider it very much and were just introducing the syntax to be consistent with the other spread syntax.
- sibeliuss 8y agoAgain, tooling: https://github.com/jhusain/eslint-plugin-immutable https://github.com/jhusain/eslint-plugin-immutable