IMO,
Short answer: no,
Long answer: noooooooooooooooooooooooooooooooooooo,
I only do this on recursive functions in the internal implementation, as an output argument. And I document this as an exception so everybody knows that's not the default way to go, but it was necessary in that case.
EDIT:
UPS, after reading the post in detail, I saw you were asking about how to make the syntax easier in your language.
I'd just say default is not mutable, and if it mutates, i'd either mark it with out or mutable as you said. I always think of mutable arguments as output arguments, a way to give a function an "empty" box (with a "particular shape", if it's not a primitive value, like an instance of a class) that the function is gonna fill for me.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
IMO,
Short answer: no,
Long answer: noooooooooooooooooooooooooooooooooooo,
I only do this on recursive functions in the internal implementation, as an output argument. And I document this as an exception so everybody knows that's not the default way to go, but it was necessary in that case.
EDIT:
UPS, after reading the post in detail, I saw you were asking about how to make the syntax easier in your language.
I'd just say default is not mutable, and if it mutates, i'd either mark it with
out
ormutable
as you said. I always think of mutable arguments as output arguments, a way to give a function an "empty" box (with a "particular shape", if it's not a primitive value, like an instance of a class) that the function is gonna fill for me.