If readability is the main concern of this article, I'd simply wrap the non mutating code in a delete function. Many libraries, such as lodash, provide this.
It's not. The main concern of this article is that too many of us (/other articles) lack nuance, and try to push developers in a single direction. While development isn't that black and white.
The TLDR is in the last paragraph:
Programming isn't black and white. We can't just ban half the keywords or native functions because they "feel wrong". There is a valid use case for each and every function
That is quite a statement. I'm not aware of any credible advice out there where the reasoning revolves around "feel wrong".
Mutation is definitely bad from my experience. While I understand where you come from, the advice in this post does not offer credible proof that promoting different styles is more important than actually following best practices.
Expressions like that are the reason I wrote this article. Mutating data is not "definitely bad". There are very valid scenarios where you want to avoid immutable patterns. And that's what I tried to explain in this post.
It's unfortunate that I didn't get this message expressed more clearly.
It's clear you're stubbornly convinced that the wider community is at fault for sharing best practices;
Thank you for the kind words.
I like to think that I'm stubbornly convinced that I'm slighly frustrated by the unnuanced "best practices" I find on the web, that are blindly followed as the "only truth" by a bit too many developers.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
If readability is the main concern of this article, I'd simply wrap the non mutating code in a
delete
function. Many libraries, such as lodash, provide this.It's not. The main concern of this article is that too many of us (/other articles) lack nuance, and try to push developers in a single direction. While development isn't that black and white.
The TLDR is in the last paragraph:
That is quite a statement. I'm not aware of any credible advice out there where the reasoning revolves around "feel wrong".
Mutation is definitely bad from my experience. While I understand where you come from, the advice in this post does not offer credible proof that promoting different styles is more important than actually following best practices.
Expressions like that are the reason I wrote this article. Mutating data is not "definitely bad". There are very valid scenarios where you want to avoid immutable patterns. And that's what I tried to explain in this post.
It's unfortunate that I didn't get this message expressed more clearly.
Mutation can only be beneficial because of machine code and computer architecture.
In an ideal world, e.g. higher level language, mutation should be avoided unless the developer really enjoys debugging.
It's clear you're stubbornly convinced that the wider community is at fault for sharing best practices; that I can do little to change.
Thank you for the kind words.
I like to think that I'm stubbornly convinced that I'm slighly frustrated by the unnuanced "best practices" I find on the web, that are blindly followed as the "only truth" by a bit too many developers.