Would it possible and appropriate for Julia to extend functionality of function definitions to include ones like this?
function f(x, z = y^2)
y = 2x
return x + y + z
end
It would need to evaluate the default value of z
as the (second) last command for the function f
since the value of its dependent variable y
could get changed anytime during the function call.
Is it possible and appropriate to design such functionality? I feel like there may be potential clashes somehow (which I haven’t been able to think of yet, but maybe something like default interdependent variables e.g. function g(x, z = 2y, y = 3z) ... end
) but those could be parsed as errors.