Interesting stuff.
I would like to take the change and ask one question:
One thing, I had to get used to is the MAIN handling of parameters.
On the command line it is important to write then named parameter in front
of the positional ones:
MAIN('compile', :$verbose, :$test-only)
needs to write:
builder.raku --verbose compile
Its not possible to write
builder.raku compile --verbose.
That is not intuitive, at least for me because that breaks with the other
unix command line tools and is annoying if you have to change the script
call several times.

Why is that so? And is there a workaround for that?
Thanks
Wolfgang

On Mon, 10 Feb 2020 at 12:18, 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-users@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
>>
>
>
> --
> __________________
>
> :(){ :|:& };:
>
>

Reply via email to