Luke Palmer wrote:
> That's because a pointy sub is not a sub. Perhaps we should call it a
> pointy block.
That might be clearer ;-)
> Not all code objects are Subs. If you call "return", then you return
> from the innermost enclosing "sub", which is marked by that word.
> Likewise does $?SUB. I don't believe $?BLOCK has been implemented yet,
> but it will.
If that's the case then the "Pointy subs" section of S06.pod should
probably be clarified a bit. It says that -> is a synonym for an
anonymous C<sub>, except for the lack of parens around the parameter
list, lack of a need for a preceeding comma when included in a list, and
the fact that it cannot be given traits. If there are more differences
they should probably be mentioned.
> To really illustrate the point, try this program:
> sub foo ($ct) {
> say "foo";
> my $s = -> $count {
> if $count < 10 {
> say $count;
> &?SUB($count + 1);
> }
> };
> $s($ct);
> }
> foo(1);
Ok, I see how it works now, but I still think the docs should be
clarified a bit.
-garrett