Author: larry
Date: Tue Sep 11 13:20:07 2007
New Revision: 14456
Modified:
doc/trunk/design/syn/S05.pod
Log:
Clarifications requested by pmichaud++
Modified: doc/trunk/design/syn/S05.pod
==============================================================================
--- doc/trunk/design/syn/S05.pod (original)
+++ doc/trunk/design/syn/S05.pod Tue Sep 11 13:20:07 2007
@@ -662,8 +662,18 @@
\s+ { print "but does contain whitespace\n" }
/
+An B<explicit> reduce from a regex closure binds the I<result object>
+for this match:
+
+ / (\d) { reduce $0.sqrt } Remainder /;
+
+This has the effect of capturing the square root of the numified string,
+instead of the string. The C<Remainder> part is matched but is not returned
+unless the first reduce is later overridden by another reduce.
+
+These closures are invoked with a topic (C<$_>) of the current match state.
Within a closure, the instantaneous position within the search is
-denoted by the special variable C<$ยข>. As with all string positions,
+denoted by the C<.pos> method on that object. As with all string positions,
you must not treat it as a number unless you are very careful about
which units you are dealing with.
@@ -1122,18 +1132,6 @@
The closure is guaranteed to be run at the canonical time; it declares
a sequence point, and is considered to be procedural.
-As with an ordinary embedded closure, an B<explicit> return from a
-regex closure binds the I<result object> for this match, ignores the
-rest of the current regex, and reports success:
-
- / (\d) <{ return $0.sqrt }> NotReached /;
-
-This has the effect of capturing the square root of the numified string,
-instead of the string. The C<NotReached> part is not reached.
-
-These closures are invoked as anonymous methods on the C<Match> object.
-See L</Match objects> below for more about result objects.
-
=item *
A leading C<&> interpolates the return value of a subroutine call as