Bruce Gray points out that this is one of the known traps:

  https://docs.raku.org/language/traps#Named_parameters

I gather there's some sort of special-casing going on where you might
think that named arguments are exactly the same a list of pairs, but
that's not precisely what's going on, and raku wants to see something
that looks like a name there, and quoting it messes that up.

I think the messaging there is particularly LTA... I think the fact
that it's a known trap indicates a need for better hints when someone
trips over this one.


On 4/18/21, yary <not....@gmail.com> wrote:
> On Sun, Apr 18, 2021 at 3:00 PM Joseph Brenner <doom...@gmail.com> wrote:
>
>> Before I get started here, a small point about defining hashes.
>> There are various ways that work:
>>
>>     my %h1 = ( 'ha' => 1, 'ho' => 2, 'hum' => 3 );
>>     my %h2 = (  ha  => 1,  ho  => 2,  hum  => 3 );
>>     my %h3 =  ha  => 1,  ho  => 2,  hum  => 3;
>>     my %h4 = 'ha' => 1, 'ho' => 2, 'hum' => 3;
>>
>>
> Those are all lists of pairs, here's another way to write it
>     my %h5 = :ha<1>, :ho<2>, :hum<3>;
>
> And even a list-of-things works as a hash initializer
>
>     my %h6 = 'ha', 1, 'ho', 2, 'hum', 3; # no pairs
>     say %h6<ho>; #2
>
> as for the main point, interesting! I have the same question about
> slurpy-named parameters now...
>

Reply via email to