It could very well be that, in practice, banning functions who’s name don’t end in ‘!’ from modifying their arguments is too difficult to be sensible - I don’t know enough about Julia to tell (I’m new too). But Tamas_Papp’s comment still made me want to express some thoughts.
I cannot rely on comments or (other) documentation being correct. I cannot rely on conventions being followed. I cannot rely on code being bug-free. But, barring bugs in the compiler, I can rely on rules of the language being followed. For instance, if a variable is declared
const, I can rely on it not being modified. Or, if a procedure argument in Fortran is declared
INTENT(IN), I can rely on it not being modified by the procedure. (In C, declaring a pointer argument to a function as
const isn’t a guarantee, but gets you pretty close)
If I can declare what some code does or does not do, using language features rather than using comments or conventions, I strongly prefer that. Because comments can be wrong, and conventions can be broken, but language rules cannot. They can be relied upon. It’s nice not just for the user/reader of some code, but also for its writer, as it may catch bugs. What if I really didn’t intend to modify a function argument, but by mistake did anyway?
Obviously, there will always be uncertainty about what some unfamiliar code does, or whether your own code have bugs. But while less uncertainty isn’t as good as no uncertainty, it is still better than more uncertainty. Let’s not refuse to reduce uncertainty just because we can’t eliminate it.
If there was a way of declaring “INTENT” for function arguments in Julia, be it with exclamation marks at the end of function names or through some other means, I think it would be nice. Not something I can’t live without, and if it’s decided it isn’t worth the trouble, I can accept that, but still - it would be nice.