Skip to content

Commit 19d6c38

Browse files
committed
document that sigs in future may not populate @_
Give people a heads up that in the next major perl release, subroutine signatures may no longer populate @_ by default. See http://nntp.perl.org/group/perl.perl5.porters/235332.
1 parent 31b1998 commit 19d6c38

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

pod/perldelta.pod

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,13 @@ breaking existing code. To avoid this a future version of perl will
296296
throw an exception when any of C<sysread()>, C<recv()>, C<syswrite()> or C<send()>
297297
are called on handle with the C<:utf8> layer.
298298

299+
=head2 Signatured subs should not rely on @_
300+
301+
Currently the experimental subroutine signature facility still populates
302+
C<@_> in addition to setting the parameter variables. In the next major
303+
release of perl this is likely to change, so that C<@_> is not populated by
304+
default (although a new mechanism will be provided to re-enable it).
305+
299306
=head1 Performance Enhancements
300307

301308
=over 4

pod/perlsub.pod

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,9 +458,11 @@ that the caller passed no arguments:
458458
return 123;
459459
}
460460

461-
When using a signature, the arguments are still available in the special
462-
array variable C<@_>, in addition to the lexical variables of the
463-
signature. There is a difference between the two ways of accessing the
461+
When using a signature, the arguments are currently still available in the
462+
special array variable C<@_>, in addition to the lexical variables of the
463+
signature, but in a future release of perl that may change to being not
464+
available by default. There is a difference between the two ways of
465+
accessing the
464466
arguments: C<@_> I<aliases> the arguments, but the signature variables
465467
get I<copies> of the arguments. So writing to a signature variable
466468
only changes that variable, and has no effect on the caller's variables,

0 commit comments

Comments
 (0)