On Wed, Jul 1, 2015 at 6:03 AM, Giuseppe Castagna <
g...@pps.univ-paris-diderot.fr> wrote:
> On 30/06/15 22:30, yary wrote:
>
> 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.
>
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 wrote:
> Section 3.2's example does not fail for the given reason "This tries to
> access
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
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
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 itsel
These two variations on Brent's work the same as the original- what subtle
differences happen by adding "anon" or "my" to the declarations?
my $sub_anon = do {
anon proto foo (|) { * }
multi foo (Int $x) { $x + 1 }
multi foo (Str $y) { $y ~ 'a' }
&foo;
}
my $sub_my = do {
my
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 (a
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
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 ";;" t
I wrote an article trying explain/propose (static) typing for Perl 6. In
particular I explain how to type subs, multi subs, classes, multi
methods; how to use union, intersection and subset types; and I finally
use these notions to explain the old problem of covariance vs.
contravariance in obj
10 matches
Mail list logo