2 ms·
FWIW, Perl 6 implicitly treats default values as closures, and calls them when no argument is passed that could bind to the optional argument. That way you get
by perlgeek 16y ago
FWIW, Perl 6 implicitly treats default values as closures, and calls them when no argument is passed that could bind to the optional argument.
That way you get a fresh array each time, and you can even use defaults that depend on previous arguments:
sub integrate(&integrand, $from, $to, $step = ($to - $from) / 100) { ... }