Thanks Timo, I was, in part, aware of this, but didn't have the full knowledge/details as you've explained it.
Thanks! On Mon, Feb 10, 2020 at 6:18 AM Timo Paulssen <t...@wakelift.de> wrote: > Hi Paul and Todd, > > just a little extra info: the limitation for nameds to come after > positionals is only for declarations of signatures. > > Usage of subs/methods as well as capture literals (which you don't use > often, i imagine, so feel free to disregard) allow you to mix nameds and > positionals freely; it will handle named parameters that are put between > positionals as if they were after the positional parameters. > > > sub abcdefg($b, $f, $g, :$a, :$c, :$e) { say $a, $b, $c, $e } > &abcdefg > > abcdefg(1, a => 5, 2, c => 99, 100, e => 1024) > 51991024 > > Most cases where I wanted named parameters early in the call was when > there was something big in the call, for example if a sub takes a block and > a few options, i prefer to put the options before the block, so they are > visible at a glance rather than after scrolling. I suppose this mirrors how > regex modifiers (like :ignorecase / :i, :global, etc) have been moved to > the front of regexes. > > Hope that's interesting > - Timo > On 10/02/2020 07:48, Paul Procacci wrote: > > Named parameters must come after all positional parameters. > Your example subroutine is invalid for this reason, while the following > would be fine: > > sub abcdefg( $b, $f, $g, :$a, :$c, :$e) > > abcdefg("position1", "position2", "position3", :e("named_e"), > :a("named_a"), :c("named_c")); > > > > On Sun, Feb 9, 2020 at 6:24 PM ToddAndMargo via perl6-users < > perl6-us...@perl.org> wrote: > >> On 2020-02-09 14:53, Paul Procacci wrote: >> > subchdir(IO() $path, :$d=True, :$r, :$w, :$x-->IO::Path:D) >> >> Hi Paul, >> >> What I wanted to see is how something liek >> >> sub abcdefg( :$a, $b, :$c, :$e, $f, $g ) >> >> would be called >> >> -T >> > > > -- > __________________ > > :(){ :|:& };: > > -- __________________ :(){ :|:& };: