Also I can easily write a madness like this:
fn madd(a: i32, b: i32) i32 {
const aa = a + 1;
const bb = b + 1;
return aa + bb;
}
yep.
if a subroutine result (returning value) does depend on it’s parameters then obviously it should not mutate them => “function” in mathematical sense => functional programming => everything is immutable => garbage collection.
otherwise do what you want with copies on stack, if you have a pointer to pointer, feel free to realloc it and so on => procedural programming => manual memory management => no hair-raising things like “monads” for i/o, you just have read and write.