Re: proto and multi

2020-07-15 Thread William Michels via perl6-users
Reviving this thread... Synopsis: the previous discussion revolved around an error seen with a whatever-star of the format "{ * }" (with spaces around the star). The error was corrected by removing the spaces to use the whatever-star "{*}" format. So why then does the Raku NativeLibs module

Re: proto and multi

2020-06-29 Thread Richard Hainsworth
@Gianni - thank you. That works. The problem in my original code - after removing the whitespace in { * } - was to have 'Positional @s' instead of 'Positional $s'. Either '@s' or 'Positional $s' work. Thanks for the rapid feedback. Richard On 29/06/2020 19:31, Gianni Ceccarelli wrote: On

Re: proto and multi

2020-06-29 Thread Gianni Ceccarelli
On 2020-06-29 Richard Hainsworth wrote: > a) I don't understand why the white space matters, but clearly it > does. So the token is '{*}' and not braces around a Whatever-star. Yep. Weird, but it's a special token. > Not sure why the List:D is not being matched to Positional. Is the > List:D

Re: proto and multi

2020-06-29 Thread Fernando Santagata
On Mon, Jun 29, 2020 at 8:22 PM Richard Hainsworth wrote: > a) I don't understand why the white space matters, but clearly it does. So > the token is '{*}' and not braces around a Whatever-star. > For an explanation see the thread "Playing with protos and phasers" that I started here three days

Re: proto and multi

2020-06-29 Thread Richard Hainsworth
a) I don't understand why the white space matters, but clearly it does. So the token is '{*}' and not braces around a Whatever-star. b) Removing the space yields the following response. in string Cannot resolve caller handle(NewClass:D: List:D); none of these signatures match:     (NewClass:

Re: proto and multi

2020-06-29 Thread Fernando Santagata
After deleting the spaces as suggested, there's a "Positional" too many. I guess you can rewrite that method declaration as multi method handle(@s) or multi method handle(Positional $s) and adjust the method's body. On Mon, Jun 29, 2020 at 7:37 PM yary wrote: > It looks like you have spaces

Re: proto and multi

2020-06-29 Thread yary
It looks like you have spaces in the token { * } can you try it without, using this {*} instead? On Mon, Jun 29, 2020, 1:29 PM Richard Hainsworth wrote: > I have several multi methods. > > All of them have the same first statement, then differ depending on the > signature. > > proto seems to be

proto and multi

2020-06-29 Thread Richard Hainsworth
I have several multi methods. All of them have the same first statement, then differ depending on the signature. proto seems to be a way to factor out the common statement, and there is a phrase in the Documentation that * can affect the dispatch, viz: "You can give the |proto| a function

[perl6/specs] 8ee967: Remove language on proto auto-multi-ing routines.

2015-10-07 Thread GitHub
paths: M S06-routines.pod Log Message: --- Remove language on proto auto-multi-ing routines. Discussion: http://irclog.perlgeek.de/perl6/2015-10-06#i_11327412

What's the intent of anon proto/anon multi?

2015-06-30 Thread yary
it to a scalar: perl6 -e my $y=anon proto foo (|) {*}; multi foo (Int $x) { $x + 1 }; say $y.name; say $y(7) which says foo, showing that the anonymous dispatcher does know its name, and then fails with Cannot call foo(Int); none of these signatures match: - no signatures listed. My understanding