Browse files

Explication of lazy warnings

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

0 comments on commit 003891a

Please sign in to comment.