Hacker News new | ask | show | jobs
by williamdclt 430 days ago
I have to say I don’t understand your point! The parents comment is both clear and a reasonable, common approach of programming

> Can the objects a function creates be mutated by functions they call?

No

> can functions modify their input parameters?

No

> If a function returns one of their input parameters (modified or not), does that mean the calling function can no longer mutate it?

No. Because the called function isn’t allowed to mutate its inputs, there’s no problem for the caller to mutate it. It’s irrelevant whether the input was also an output of the called function as it cannot mutate it anyway.

I suppose you can get into race conditions between caller and callee if your language provides asynchronicity and no further immutability guarantees. Still, you eliminated a whole lot of potential bugs