4 ms·
> well that's just bad programming. There are a lot of situations where it is/may seem prudent to pass a reference to something, mutate it, then return
by pdntspa 3y ago
> well that's just bad programming.
There are a lot of situations where it is/may seem prudent to pass a reference to something, mutate it, then return
- hmmokidk 3y agoOnly reason I can think of is performance.
- pdimitar 3y agoYou can do that in Erlang/Elixir too, though you are passing a name/ID of the thing, not a reference to the thing itself (not in the sense of C/C++ or Rust references anyway).
- boxed 3y agoThere are. Yes. But the previous poster seems to imply they have NEVER seen code written like that that would be improved by making it a pure function that returns a value for the caller to assign. Never? That seems unlikely to me. Unless they've only worked with really really amazing programmers. Even then it seems unlikely.