Consider:
my $foo of Num where { 0 <= $^n < 10 };
Is the following also valid?
my $foo where { 0 <= $^n < 10 };
Or does that have to be like this?
my $foo of Scalar where { 0 <= $^n < 10 };
And can $_ be used instead of $^n?
Juerd
Juerd writes:
> Consider:
>
> my $foo of Num where { 0 <= $^n < 10 };
>
> Is the following also valid?
>
> my $foo where { 0 <= $^n < 10 };
I don't see why not. The main place C will be useful is in
multimethods, and I see that as a reasonable shorthand:
multi sub foo(Bar $x, $y w
Luke Palmer skribis 2005-01-28 9:31 (-0700):
> > And can $_ be used instead of $^n?
> Of course it can. You know that.
I do?
Can't say I understand well when a topic is implicitly defined and when
not. It's obvious for for-loops and given, but everything else is
blurry to me.
Juerd
Juerd writes:
> Luke Palmer skribis 2005-01-28 9:31 (-0700):
> > > And can $_ be used instead of $^n?
> > Of course it can. You know that.
>
> I do?
>
> Can't say I understand well when a topic is implicitly defined and when
> not. It's obvious for for-loops and given, but everything else is
>