CurtTilmes / raku-dbsqlite

SQLite access for Raku
10 stars 4 forks source link

can't use a named bind parameters with execute #18

Open masukomi opened 2 years ago

masukomi commented 2 years ago

The method signature of execute

    method execute(Bool :$finish, *@args, *%args)

is such that the third parameter (%args) is never going to be populated. *@args always steals the data that would be caught by *%args.

As a result it always raises an error if you try to call it with a hash parameter, because it uses the list block instead of the named parameter block.

here's a little test routine from in the REPL to prove this.

[253] > sub foo(Bool :$finish, *@args, *%args) { if @args { say "@args";}; if %args { say "%args";}}
&foo
[254] > foo(@list);
@args
[254] > foo(%hash);
@args
[254] > foo(@list, %hash);
@args

on a related note: the docs for this method don't match the signature of the method

=head2 B<execute>(**@args, Bool :$finish)