4 ms·
The main takeaway is that this isn't necessary with mutable structures. Nobody would think of even trying to write a generic solution to a problem that doesn't
by atilaneves 8y ago
The main takeaway is that this isn't necessary with mutable structures. Nobody would think of even trying to write a generic solution to a problem that doesn't exist in C++.
- marcosdumay 8y agoLens are about composition and abstracting your operations over unknown structures. I don't know where did you find anything about immutability, as plain data accessors are perfectly fine for that. The motivation on the article is basically this paragraph: "Lenses allow you to abstract state shape behind getters and setters. Instead of littering your codebase with code that dives deep into the shape of a particular object, import a lens. If you later need to change the state shape, you can do so in the lens, and none of the code that depends on the lens will need to change." Immutability does not make its way there.