Author: audreyt Date: Wed Jul 26 07:21:13 2006 New Revision: 10478 Modified: doc/trunk/design/syn/S04.pod doc/trunk/design/syn/S06.pod
Log: * S04, S06: "Pointy sub" and "Pointy block" was used interchangeably in the text, but as uri++ pointed out, it was very confusing as we also say that "return" escapes from subs but not blocks. Hence, rename all mention of "pointy sub" to "pointy block". Modified: doc/trunk/design/syn/S04.pod ============================================================================== --- doc/trunk/design/syn/S04.pod (original) +++ doc/trunk/design/syn/S04.pod Wed Jul 26 07:21:13 2006 @@ -14,7 +14,7 @@ Date: 19 Aug 2004 Last Modified: 26 July 2006 Number: 4 - Version: 30 + Version: 31 This document summarizes Apocalypse 4, which covers the block and statement syntax of Perl. @@ -488,7 +488,7 @@ A C<return> always exits from the lexically surrounding sub or method definition (that is, from a function officially declared -with the C<sub>, C<method>, or C<submethod> keywords). Pointy subs +with the C<sub>, C<method>, or C<submethod> keywords). Pointy blocks and bare closures are transparent to C<return>. If you pass a closure object outside of its official "sub" scope, it is illegal to return from it. You may only leave the closure block itself with C<leave> Modified: doc/trunk/design/syn/S06.pod ============================================================================== --- doc/trunk/design/syn/S06.pod (original) +++ doc/trunk/design/syn/S06.pod Wed Jul 26 07:21:13 2006 @@ -15,7 +15,7 @@ Date: 21 Mar 2003 Last Modified: 26 July 2006 Number: 6 - Version: 41 + Version: 42 This document summarizes Apocalypse 6, which covers subroutines and the @@ -132,13 +132,13 @@ it is considered the final element of that list unless followed immediately by a comma or comma surrogate. -=head2 "Pointy subs" +=head2 "Pointy blocks" Semantically the arrow operator C<< -> >> is almost a synonym for the anonymous C<sub> keyword, except that the parameter list of a -pointy sub does not require parentheses, and a pointy sub may not be -given traits. Syntactically a pointy sub is parsed exactly like a -bare block. +pointy block does not require parentheses, and a pointy block may not be +given traits. Syntactically, a pointy block is parsed exactly like a +bare block: my $sq = -> $val { $val**2 }; say $sq(10); # 100 @@ -149,7 +149,7 @@ } It also behaves like a block with respect to control exceptions. If you -C<return> from within a pointy sub, it will return from the innermost +C<return> from within a pointy block, it will return from the innermost enclosing C<sub> or C<method>, not the block itself. It is referenced by C<&?BLOCK>, not C<&?ROUTINE>.