Skip to content
This repository
Browse code

Explication of lazy warnings

Lazy warning are to be used for +, ~ and ? conversions, as well as
for the ??? stub.
  • Loading branch information...
commit 003891a8e432b5e5bc283288adeef6387a7ddb01 1 parent 76c977a
Larry Wall authored July 28, 2012
7  S02-bits.pod
Source Rendered
@@ -14,7 +14,7 @@ Synopsis 2: Bits and Pieces
14 14
     Created: 10 Aug 2004
15 15
 
16 16
     Last Modified: 28 Jul 2012
17  
-    Version: 267
  17
+    Version: 268
18 18
 
19 19
 This document summarizes Apocalypse 2, which covers small-scale
20 20
 lexical items and typological issues.  (These Synopses also contain
@@ -2264,8 +2264,9 @@ Since method calls are performed directly on any object, C<Nil>
2264 2264
 can respond to certain method calls.  C<Nil.defined> returns
2265 2265
 C<False> (whereas C<().defined> returns C<True>).  C<Nil.so> also
2266 2266
 returns C<False>.  C<Nil.ACCEPTS> matches only a C<Nil> value.  C<Nil.perl> and
2267  
-C<Nil.gist> return C<'Nil'>.  C<Nil.Stringy> and C<Nil.Str> return '' with a warning.
2268  
-C<Nil.Numeric> returns 0 with a warning.  Any undefined method call
  2267
+C<Nil.gist> return C<'Nil'>.  C<Nil.Stringy> and C<Nil.Str> fail with a resumable warning
  2268
+that returns a value of C<''> on resumption.  C<Nil.Numeric> likewise fails
  2269
+with resumable warning that returns 0 on resumption.  Any undefined method call
2269 2270
 on C<Nil> returns C<Nil>, so that C<Nil> propagates down method
2270 2271
 call chains.
2271 2272
 
11  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: 28 Jul 2012
17  
-    Version: 117
  17
+    Version: 118
18 18
 
19 19
 This document summarizes Apocalypse 4, which covers the block and
20 20
 statement syntax of Perl.
@@ -1216,6 +1216,15 @@ separate from the catch lambda, though an implementation is allowed
1216 1216
 to combine them if it is careful to retain separate semantics for
1217 1217
 catch and control exceptions.
1218 1218
 
  1219
+One additional level of control is the notion of I<lazy warnings>.
  1220
+If, instead of throwing a warning directly, the program calls C<fail()>
  1221
+with a resumable exception, the throwing of the warning is delayed
  1222
+until first use (or the caller's policy) requires it to be thrown.
  1223
+If the warning exception supports the C<.resume_value> method, that
  1224
+will be the value of the failure after it has resumed.  Otherwise the
  1225
+value will be the null string.  The C<+>, C<~>, and C<?> coercions
  1226
+use these lazy warnings to allow (but not require) failsoft semantics.
  1227
+
1219 1228
 =head1 The goto statement
1220 1229
 X<goto>
1221 1230
 
7  S06-routines.pod
Source Rendered
@@ -16,8 +16,8 @@ Synopsis 6: Subroutines
16 16
 
17 17
     Created: 21 Mar 2003
18 18
 
19  
-    Last Modified: 23 Jan 2012
20  
-    Version: 154
  19
+    Last Modified: 28 Jul 2012
  20
+    Version: 155
21 21
 
22 22
 This document summarizes Apocalypse 6, which covers subroutines and the
23 23
 new type system.
@@ -448,7 +448,8 @@ you must explicitly use the "C<supersede>" declarator.  (The compiler may
448 448
 refuse to do this if it has already committed to the previous definition.)
449 449
 
450 450
 The C<...> is the "yadayadayada" operator, which is executable but
451  
-returns a failure.  You can also use C<???> to produce a warning,
  451
+returns a failure.  You can also use C<???> to fail with a warning
  452
+(a lazy one, to be issued only if the the value is actually used),
452 453
 or C<!!!> to always die.  These also officially define stub blocks.
453 454
 Any of these yada operators will be taken as a stub if used as the main
454 455
 operator of the first statement in the block.  (Statement modifiers

0 notes on commit 003891a

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