How complex can a parameter default expression be?
# Brendan Eich (18 years ago)
On Dec 21, 2007, at 4:53 AM, P T Withington wrote:
Can it refer to previous parameters? Assign to them? Is this legal?
function foo (a:t = x, b:u = (a = y, z))
AFAIK the formal parameters (bound in the variable object of the
activation of foo) are not in scope when default parameters are
computed.
# Dave Herman (18 years ago)
That seems like an unnecessary restriction, no? Since argument evaluation is already restricted to left-to-right, we could allow default-expressions to refer to earlier arguments without too much trouble, unless I'm missing something obvious.
Can it refer to previous parameters? Assign to them? Is this legal?
function foo (a:t = x, b:u = (a = y, z))