Jonathan (>):
> O AKSHUALY...that's quite easy to do, since we just calls .WHAT on the value
> to get its proto-object and stick it in the sig. So perhaps best is just to
> re-define:
>
> multi sub fib (LITERAL) { ... }
>
> As meaning
>
> multi sub fib (LITERAL.WHAT $ where LITERAL) { ... }
I like
Mark J. Reed wrote:
Shouldn't that desugar to (Int $ where 0)? After all, 0.WHAT is Int...
Yes, I proposed that in my second reply too, after realizing .WHAT gave
us that too. :-)
Of course, then someone will expect multi sub fib (0|1) { return @_[0]
} to DTRT here...
That's fine, bec
2009/3/18 Moritz Lenz :
>> +You can leave out the block when matching against a literal value of some
>> +kind:
>> +
>> + multi sub fib ($n where 0|1) { return $n }
>> + multi sub fib (Int $n) { return fib($n-1) + fib($n-2) }
>> +
>> +In fact, you can leave out the 'where' declaration altoget
Jonathan Worthington wrote:
Moritz Lenz wrote:
pugs-comm...@feather.perl6.nl wrote:
+You can leave out the block when matching against a literal value
of some
+kind:
+
+multi sub fib ($n where 0|1) { return $n }
+multi sub fib (Int $n) { return fib($n-1) + fib($n-2) }
+
+In fact, yo
Moritz Lenz wrote:
pugs-comm...@feather.perl6.nl wrote:
+You can leave out the block when matching against a literal value of some
+kind:
+
+multi sub fib ($n where 0|1) { return $n }
+multi sub fib (Int $n) { return fib($n-1) + fib($n-2) }
+
+In fact, you can leave out the 'where' d
pugs-comm...@feather.perl6.nl wrote:
> Author: masak
> Date: 2009-03-14 13:34:42 +0100 (Sat, 14 Mar 2009)
> New Revision: 25821
>
> Modified:
>docs/Perl6/Spec/S12-objects.pod
> Log:
> specced syntactic 'where' sugar in param lists
>
> Modified: docs/Perl6/Spec/S12-objects.pod
> ==
Author: masak
Date: 2009-03-14 13:34:42 +0100 (Sat, 14 Mar 2009)
New Revision: 25821
Modified:
docs/Perl6/Spec/S12-objects.pod
Log:
specced syntactic 'where' sugar in param lists
Modified: docs/Perl6/Spec/S12-objects.pod
===
--- d