On 10/10/05, Austin Hastings <[EMAIL PROTECTED]> wrote: > What about whitespace? > > foo (a => 42); # Note space > > Is that the first case (subcall with named arg) or the second case (sub > with positional pair)?
Sub with positional pair, since the parens aren't call-parens (because of the space), so they protect the pair. It would probably be prudent to emit a warning in this case, for obvious reasons. (Actually, this is one of the major problems with using parens to protect pair args.) > What's the most complete way to get the sub's arguments? > > That is, for a sub that takes positional, optional, named, and variadic > (*) arguments, what's the best mechanism for grabbing the entire call? As far as I know there currently *isn't* a concise way to capture/forward all (or some) of a sub's arguments; the closest thing is: sub foo([EMAIL PROTECTED], *%named) { bar([EMAIL PROTECTED], *%named) } Which is ugly and unwieldy. I believe Luke was considering some kind of 'unified arg-list object' which you could use to slurp and splat entire argument lists, like so: sub foo(*$args) { bar(*$args) } But I don't think it's been posted to the list yet. Stuart