summaryrefslogtreecommitdiff
path: root/pod
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2017-11-28 20:21:36 +0000
committerZefram <zefram@fysh.org>2017-11-28 20:21:36 +0000
commit869b8c119a7436d3373e1325925a8b753d0e7805 (patch)
tree3921dc8c6433c9b3af3c73a3726ec713eb1c6f55 /pod
parent9e0909b2180c408354ce24b6c742f4b79e783d11 (diff)
downloadperl-869b8c119a7436d3373e1325925a8b753d0e7805.tar.gz
remove useless "default" mechanism
Diffstat (limited to 'pod')
-rw-r--r--pod/perldiag.pod10
-rw-r--r--pod/perlfunc.pod8
-rw-r--r--pod/perlsyn.pod25
3 files changed, 14 insertions, 29 deletions
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index efc1c3f54d..84ddac4060 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -833,8 +833,7 @@ but then $foo no longer contains a glob.
=item Can't "continue" outside a when block
-(F) You called C<continue>, but you're not inside a C<when>
-or C<default> block.
+(F) You called C<continue>, but you're not inside a C<when> block.
=item Can't create pipe mailbox
@@ -846,13 +845,6 @@ quotas or other plumbing problems.
(F) Only scalar, array, and hash variables may be declared as "my", "our" or
"state" variables. They must have ordinary identifiers as names.
-=item Can't "default" outside a topicalizer
-
-(F) You have used a C<default> block that is neither inside a
-C<foreach> loop nor a C<given> block. (Note that this error is
-issued on exit from the C<default> block, so you won't get the
-error if you use an explicit C<continue>.)
-
=item Can't determine class of operator %s, assuming BASEOP
(S) This warning indicates something wrong in the internals of perl.
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod
index 41fc176026..0f88ba4c55 100644
--- a/pod/perlfunc.pod
+++ b/pod/perlfunc.pod
@@ -269,7 +269,7 @@ L<C<wantarray>|/wantarray>
L<C<break>|/break> is available only if you enable the experimental
L<C<"switch"> feature|feature/The 'switch' feature> or use the C<CORE::>
prefix. The L<C<"switch"> feature|feature/The 'switch' feature> also
-enables the C<default>, C<given> and C<when> statements, which are
+enables the C<given> and C<when> statements, which are
documented in L<perlsyn/"Switch Statements">.
The L<C<"switch"> feature|feature/The 'switch' feature> is enabled
automatically with a C<use v5.10> (or higher) declaration in the current
@@ -426,7 +426,7 @@ L<C<time>|/time>, L<C<times>|/times>
=for Pod::Functions =!Non-functions
C<and>, C<AUTOLOAD>, C<BEGIN>, C<CHECK>, C<cmp>, C<CORE>, C<__DATA__>,
-C<default>, C<DESTROY>, C<else>, C<elseif>, C<elsif>, C<END>, C<__END__>,
+C<DESTROY>, C<else>, C<elseif>, C<elsif>, C<END>, C<__END__>,
C<eq>, C<for>, C<foreach>, C<ge>, C<given>, C<gt>, C<if>, C<INIT>, C<le>,
C<lt>, C<ne>, C<not>, C<or>, C<UNITCHECK>, C<unless>, C<until>, C<when>,
C<while>, C<x>, C<xor>
@@ -1340,7 +1340,7 @@ using an empty one, logically enough, so L<C<next>|/next LABEL> goes
directly back to check the condition at the top of the loop.
When there is no BLOCK, L<C<continue>|/continue BLOCK> is a function
-that exits the current C<when> or C<default> block, avoiding the jump
+that exits the current C<when> block, avoiding the jump
to the end of the enclosing topicalizer that implicitly happens when
execution reaches the end of such a block.
In Perl 5.14 and earlier, this form of
@@ -10103,8 +10103,6 @@ Statements">.
=over
-=item default
-
=item given
=item when
diff --git a/pod/perlsyn.pod b/pod/perlsyn.pod
index fbfa4e653b..cb12a3590f 100644
--- a/pod/perlsyn.pod
+++ b/pod/perlsyn.pod
@@ -247,7 +247,6 @@ The following compound statements may be used to control flow:
given (EXPR) BLOCK
when (EXPR) BLOCK
- default BLOCK
LABEL while (EXPR) BLOCK
LABEL while (EXPR) BLOCK continue BLOCK
@@ -268,7 +267,7 @@ The following compound statements may be used to control flow:
PHASE BLOCK
-The experimental C<given>, C<when>, and C<default> statements are I<not
+The experimental C<given> and C<when> statements are I<not
automatically enabled>; see L</"Switch Statements"> below for how to do
so, and the attendant caveats.
@@ -607,7 +606,7 @@ described immediately below remains experimental.
=head2 Switch Statements
-X<switch> X<case> X<given> X<when> X<default>
+X<switch> X<case> X<given> X<when>
C<given>, C<when>, and related keywords make up an experimental feature
that first appeared in Perl 5.10, but behaved quite differently from
@@ -622,7 +621,7 @@ example:
use v5.14;
Under the "switch" feature, Perl gains the experimental keywords C<given>,
-C<when>, C<default>, and C<break>. Starting from Perl 5.16, one can
+C<when>, and C<break>. Starting from Perl 5.16, one can
prefix the switch keywords with C<CORE::> to access the feature without
a C<use feature> statement.
@@ -640,7 +639,7 @@ C<given> evaluates its argument in scalar context, and executes its block
with the C<$_> variable locally aliased to the result of evaluating the
argument expression. It is much like a C<foreach> loop that always has
exactly one item to iterate over. Either a C<given> or a C<foreach>
-construct serves as a I<topicalizer>: C<when> and C<default> can only
+construct serves as a I<topicalizer>: C<when> can only
be used in the dynamic scope of a topicalizer.
C<when> evaluates its argument as a truth value. If the argument
@@ -651,10 +650,6 @@ topicalizer. (In the case of a C<foreach> topicalizer, this jump
behaves as a C<next>, moving on to the next iteration, not a C<last>,
which would exit the loop.)
-C<default> always executes its block and then implicitly jumps to the
-end of the closest dynamically enclosing topicalizer. It is precisely
-equivalent to C<when(1)>.
-
Putting this together, the code in the previous section could be
rewritten as
@@ -663,7 +658,7 @@ rewritten as
when (/^abc/) { $abc = 1 }
when (/^def/) { $def = 1 }
when (/^xyz/) { $xyz = 1 }
- default { $nothing = 1 }
+ $nothing = 1;
}
Or if you prefer the modifier form of C<when>, it can be written with
@@ -674,16 +669,16 @@ less punctuation as
$abc = 1 when /^abc/;
$def = 1 when /^def/;
$xyz = 1 when /^xyz/;
- default { $nothing = 1 }
+ $nothing = 1;
}
You can use the C<break> keyword to break out of the dynamically enclosing
topicalizer, if it's a C<given> block. This resembles the jump to the end
of the topicalizer that implicitly happens at the end of every C<when>
-or C<default> block, except that the explicit C<break> can only break
+block, except that the explicit C<break> can only break
out of a C<given> topicalizer, not a C<foreach>.
-You can use the C<continue> keyword to exit a C<when> or C<default>
+You can use the C<continue> keyword to exit a C<when>
block, proceeding to the following statement. This is most commonly
done last thing inside the block, to override the implicit jump to the
end of the topicalizer. For example
@@ -691,7 +686,7 @@ end of the topicalizer. For example
given($foo) {
when (/x/) { say '$foo contains an x'; continue }
when (/y/) { say '$foo contains a y' }
- default { say '$foo does not contain a y' }
+ say '$foo does not contain a y';
}
When a C<given> statement is executed in a position where it will provide
@@ -707,7 +702,7 @@ An empty list as soon as an explicit C<break> is encountered.
=item *
The value of the last evaluated expression of the successful
-C<when>/C<default> clause, if there happens to be one.
+C<when> clause, if there happens to be one.
=item *