Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You don't need to wrap fields. You just pass the classes.

Think about why nobody but you is inconvenienced by this. I am sorry, this is a you problem, because you are violating common idioms of the language.

There is basically never a reason not to pass your data structure to a function, which is why what you are doing is an incredibly niche functionality.

Also functions should be particular to data structure. That is why types exists.




General functions are useful.

It is not a me problem, which is why Rust has fixed this. You are arguing that functions which mutate parameters generally are not useful, which isn't true. You have implied that I have a lack of knowledge of data structures, my code wouldn't pass code review. Reflect: You are proposing it is preferable to have a simple function accept a whole data structure when it may only act on one or more of its fields, and may be used in other places. That is a semantic misdirection, and provincialization.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: