This week's Curious About Code newsletter talks about the benefits of immutability and how to protect yourself from badly behaving code using defensive copying. Check it out!
https://davidamos.dev/never-modify-inputs-without-permission/
https://davidamos.dev/never-modify-inputs-without-permission/