Hacker News new | ask | show | jobs
by the__alchemist 553 days ago
You have missed the point: Functions should not need to be provincial to a specific data structure. Nor should data structures include field wrappers to subvert a language's sloppy mutation semantics.

The point is that with mutable references, you can modify only the part of the struct you need to, using a general function. You can use this same function to modify a different part of the structure, or a different structure, or a free variable.

Your inference that preferring mutable references to wrapper structs implies insufficient knowledge of data structures is puzzling and incorrect.