Skip to content

Commit a6a6eee

Browse files
committed
Add @_ in signatured sub being experimental to perldelta.pod
1 parent 449fd5f commit a6a6eee

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

pod/perldelta.pod

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,34 @@ here, but most should go in the L</Performance Enhancements> section.
2727

2828
[ List each enhancement as a =head2 entry ]
2929

30+
=head2 @_ is now experimental within signatured subs
31+
32+
Even though subroutine signatures currently remain experimental, use of the
33+
default arguments array (C<@_>) with a subroutine that has a signature is
34+
specifically also experimental, with its own warning category. Silencing the
35+
C<experimental::signatures> warning category is not sufficient to dismiss
36+
this. The new warning is emitted with the category name
37+
C<experimental::args_array_with_signatures>.
38+
39+
Any subroutine that has a signature and tries to make use of the defaults
40+
argument array or an element thereof (C<@_> or C<$_[INDEX]>), either
41+
explicitly or implicitly (such as C<shift> or C<pop> with no argument) will
42+
provoke a warning at compile-time:
43+
44+
use experimental 'signatures';
45+
46+
sub f ($x, $y = 123) {
47+
say "The first argument is $_[0]";
48+
}
49+
50+
Z<>
51+
52+
Use of @_ in array element with signatured subroutine is experimental
53+
at file.pl line 4.
54+
55+
The behaviour of code which attempts to do this is no longer specified, and
56+
may be subject to change in a future version.
57+
3058
=head1 Security
3159

3260
XXX Any security-related notices go here. In particular, any security

0 commit comments

Comments
 (0)