Page MenuHomePhabricator

Should function arguments be assignable or mutable?
Closed, ResolvedPublic

Asked by jcmcdonald on Jan 1 2018, 12:34 PM.


There's an interesting discussion on about whether function arguments should be mutable. I think this topic bears consideration in Ratscript.


Updated 1,974 Days Ago

I think I agree with the article's assertion: function arguments should be immutable by default, unless explicitly marked otherwise. I believe this will prevent mistakes from functions modifying their inputs directly.

Updated 1,165 Days Ago

I don't think it's relevant if you consider arguments as variable assignment. Then just do whatever the rest of the language does with variables. If they're immutable, then they're immutable, if not, then you should be able to assign to them using whatever scope rules you have. See for an explanation of how languages like C and Scheme do it.

New Answer


This question has been marked as closed, but you can still leave a new answer.