Re: Types for Perl 6: request for comments

2015-06-30 Thread yary
Now that I've read ahead to 3.4, the multi method solution shown can be a little simpler, just need to add multi to the original equal methods, see attached. -y On Tue, Jun 30, 2015 at 4:16 PM, yary not@gmail.com wrote: Section 3.2's example does not fail for the given reason This tries to

Re: Types for Perl 6: request for comments

2015-06-30 Thread yary
Section 3.2's example does not fail for the given reason This tries to access the c instance variable of the argument $b thus yielding a run-time error - instead Perl6 more correctly complains that it was expecting a ColPoint, but got a Point instead. Indeed one cannot generally replace a subtype

Re: Types for Perl 6: request for comments

2015-06-27 Thread Brent Laabs
On Fri, Jun 26, 2015 at 4:32 AM, Giuseppe Castagna g...@pps.univ-paris-diderot.fr wrote: my $sub = do { proto foo (|) { * } multi foo (Int $x) { $x + 1 } multi foo (Str $y) { $y ~ 'a' } foo; } Oh yes, nice ... I think I will add it in my paper (and if you send me

Re: Types for Perl 6: request for comments

2015-06-27 Thread Giuseppe Castagna
On 24/06/15 21:27, yary wrote: I'm reading it a bit at a time on lunch break, thanks for sending it along, it's educational. My comments here are all about the example on the top of page 5, starting with the minutest. First a typo, it says subC where it should say sumC multi sub sumB is

Re: Types for Perl 6: request for comments

2015-06-27 Thread yary
The anon does something. For example this code prints bob my $routine = proto bar (|) { * }; multi bar (Int $x) { $x - 2 } multi bar (Str $y) { $y ~ 'b' } say $routine('bo'); but change the first line to my $routine = anon proto bar (|) { * }; and you get an error Cannot call 'bar'; none of

Re: Types for Perl 6: request for comments

2015-06-27 Thread Brent Laabs
Subs are lexical by default, so adding my to the function declarators does nothing. Not sure what anon is doing there. My guess is that anon in sink context does nothing, and Rakudo just builds another proto for foo when it sees the first multi. Protos are optional (but not in the compiler

Re: Types for Perl 6: request for comments

2015-06-24 Thread yary
I'm reading it a bit at a time on lunch break, thanks for sending it along, it's educational. My comments here are all about the example on the top of page 5, starting with the minutest. First a typo, it says subC where it should say sumC multi sub sumB is ambiguous, due to your use of ;; there.