On Mon, Nov 18, 2002 at 08:05:47AM +1100, Damian Conway wrote: : I still think my original: : : sub bar(; $foo = $topic) is given($topic) {...} : : is the appropriate compromise.
Won't fly. Referring to something lexical before it's declared is a no-no. I think we need some other way of indicating the outer topic if we're gonna use it as a default, and I think we do want that. Perhaps it's a good time for a real keyword for use in defaults: sub bar(; $foo = topic) {...} That would let us work it nicely for arrays too: sub bar(*@args = [topic]) {...} Without the [], people might get confused about what to do with a $_ containing an array reference. But maybe that means it should really be a magical variable so we can distinguish sub bar(*@args = $<mumble>) {...} # default to [$_] sub bar(*@args = @$<mumble>) {...} # default to @$_ What <mumble> might be is an interesting, er, topic. Larry