Skip to content
This repository
Browse code

resumable failures for coercions

fixes #17
  • Loading branch information...
commit 5dfd99666bd8c05b7fc9de87d5c306c2399dfa08 1 parent 75e74e0
Larry Wall authored July 28, 2012

Showing 1 changed file with 12 additions and 3 deletions. Show diff stats Hide diff stats

  1. 15  S04-control.pod
15  S04-control.pod
Source Rendered
@@ -13,8 +13,8 @@ Synopsis 4: Blocks and Statements
13 13
 
14 14
     Created: 19 Aug 2004
15 15
 
16  
-    Last Modified: 11 Mar 2012
17  
-    Version: 116
  16
+    Last Modified: 28 Jul 2012
  17
+    Version: 117
18 18
 
19 19
 This document summarizes Apocalypse 4, which covers the block and
20 20
 statement syntax of Perl.
@@ -1246,7 +1246,8 @@ lexical scope of the C<goto>) must enclose the label in quotes.
1246 1246
 
1247 1247
 As in Perl 5, many built-in functions simply return an undefined value
1248 1248
 when you ask for a value out of range, or the function fails somehow.
1249  
-Perl 6 has C<Failure> objects, known as "unthrown exceptions", which
  1249
+Perl 6 has C<Failure> objects, known as "unthrown exceptions" (though
  1250
+really a C<Failure> merely contains an unthrown exception), which
1250 1251
 know whether they have been handled or not.  C<$!> is a convenient
1251 1252
 link to the last failure, and only ever contains one exception, the
1252 1253
 most recent.
@@ -1308,6 +1309,14 @@ the implicit outermost exception handler will
1308 1309
 eventually decide to abort and print all unhandled exceptions passed
1309 1310
 in as its current C<@!> list.
1310 1311
 
  1312
+It is possible to fail with a resumable exception, such as a warning.
  1313
+If the failure throws its exception and the exception resumes,
  1314
+the thrower by default returns the null string (C<''>) to whatever
  1315
+caused the failure to throw its exception.  This may be overridden by
  1316
+attaching a C<.resume_value> to the warning.  Hence numeric coercions
  1317
+such as C<+"42foo"> can be forced to return C<42> after issuing
  1318
+a warning.
  1319
+
1311 1320
 =head1 Phasers
1312 1321
 
1313 1322
 A C<CATCH> block is just a trait of the closure containing it, and is

0 notes on commit 5dfd996

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