|
|
|
|
|
by constantcrying
549 days ago
|
|
I explicitly excluded primitive types in my previous comment. I have never seem a codebase where this was an issue. The most important concept in programming is defining your data structures. Professional programs almost never operate on primitive data structures, but always on larger structures, like classes or structs. This is why this is only a problem for you. I don't want to be insulting, but you need to brush up on your data structures. The need to pass a modifiable data structure almost never arises, the idiom in your OP is extremely uncommon and would likely not pass any code review. |
|
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.