Skip to content
This repository
Browse code

[S04] rename break/nobreak to succeed/proceed

git-svn-id: http://svn.pugscode.org/pugs@29365 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
commit f8bc519c44d476d8bef23cbcc65bcaa816b40365 1 parent ebb370d
authored December 18, 2009
31  S04-control.pod
Source Rendered
@@ -14,7 +14,7 @@ Synopsis 4: Blocks and Statements
14 14
     Created: 19 Aug 2004
15 15
 
16 16
     Last Modified: 17 Dec 2009
17  
-    Version: 92
  17
+    Version: 93
18 18
 
19 19
 This document summarizes Apocalypse 4, which covers the block and
20 20
 statement syntax of Perl.
@@ -849,7 +849,7 @@ which surrounding construct was intended as the actual topicalizer.)
849 849
 The value of the inner block is returned as the value of the outer
850 850
 block.
851 851
 
852  
-If the smart match fails, control passes to the next statement
  852
+If the smart match fails, control proceeds the next statement
853 853
 normally, which may or may not be a C<when> statement.  Since C<when>
854 854
 statements are presumed to be executed in order like normal statements,
855 855
 it's not required that all the statements in a switch block be C<when>
@@ -875,27 +875,29 @@ explicitly or implicitly), that parameter can function as the topic
875 875
 of any C<when> statements within the loop.
876 876
 
877 877
 You can explicitly break out of a C<when> block (and its surrounding
878  
-topicalizer block) early using the C<break> verb.  More precisely,
  878
+topicalizer block) early using the C<succeed> verb.  More precisely,
879 879
 it first scans outward (lexically) for the innermost containing
880 880
 C<when> block.  From there it continues to scan outward to find the
881 881
 innermost block outside the C<when> that uses C<$_> as one of its
882 882
 formal parameters, either explicitly or implicitly.  (Note that
883 883
 both of these scans are done at compile time; if the scans fail,
884 884
 it's a compile-time semantic error.)  Typically, such an outer
885  
-block will be a C<given> or a C<for> statement, but any block that
  885
+block will be the block of a C<given> or a C<for> statement, but any block that
886 886
 sets the topic in its signature can be broken out of.  At run time,
887  
-C<break> uses a control exception to scan up the dynamic chain to
  887
+C<succeed> uses a control exception to scan up the dynamic chain to
888 888
 find the call frame belonging to that same outer block, and
889 889
 when it has found that frame, it does a C<.leave> on it to unwind
890  
-the call frames.  If any arguments are supplied to the C<break> function,
  890
+the call frames.  If any arguments are supplied to the C<succeed> function,
891 891
 they are passed out via the C<leave> method.  Since leaving a block is
892  
-considered a successful return, breaking out of one is also considered
893  
-a successful return.  (And in fact, the implicit break of a normal
  892
+considered a successful return, breaking out of one with C<succeed> is also considered
  893
+a successful return for the purposes of C<KEEP> and C<UNDO>.
  894
+
  895
+The implicit break of a normal
894 896
 C<when> block works the same way, returning the value of the entire
895  
-block (normally from its last statement) via an implicit C<.leave>.)
  897
+block (normally from its last statement) via an implicit C<succeed>.
896 898
 
897 899
 You can explicitly leave a C<when> block and go to the next statement
898  
-following the C<when> by using C<nobreak>.  (Note that, unlike C's
  900
+following the C<when> by using C<proceed>.  (Note that, unlike C's
899 901
 idea of "falling through", subsequent C<when> conditions are evaluated.
900 902
 To jump into the next C<when> block without testing its condition,
901 903
 you must use a C<goto>.  But generally that means you should refactor
@@ -908,15 +910,16 @@ and thence on to the next iteration of the loop.  You must use C<last>
908 910
 (or some more violent control exception such as C<return>) to break
909 911
 out of the entire loop early.  Of course, an explicit C<next> might
910 912
 be clearer than a C<break> if you really want to go directly to the
911  
-next iteration.  On the other hand, C<break> can take an optional
  913
+next iteration.  On the other hand, C<succeed> can take an optional
912 914
 argument giving the value for that iteration of the loop.  As with
913  
-the C<.leave> method, there is also a C<.break> method to break from a
  915
+the C<.leave> method, there is also a C<.succeed> method to break from a
914 916
 labelled block functioning as a switch:
915 917
 
916  
-    OUTER.break($retval)
  918
+    OUTER.succeed($retval)
917 919
 
918 920
 There is a C<when> statement modifier, but it does not have any
919  
-break semantics.  That is,
  921
+breakout semantics; it is merely a smartmatch against
  922
+the current topic.  That is,
920 923
 
921 924
     doit() when 42;
922 925
 
4  S29-functions.pod
Source Rendered
@@ -953,8 +953,8 @@ OS objects:
953 953
 
954 954
 =item Flow control
955 955
 
956  
-break
957  
-continue
  956
+succeed
  957
+proceed
958 958
 redo
959 959
 
960 960
 =item Other

0 notes on commit f8bc519

Please sign in to comment.
Something went wrong with that request. Please try again.