Skip Menu |
Report information
Id: 128654
Status: open
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors:
Cc:
AdminCc:

Operating System: (no value)
PatchStatus: (no value)
Severity: low
Type:
Perl Version: (no value)
Fixed In: (no value)



Subject: [EXPERIMENT] Declared references
Download (untitled) / with headers
text/plain 292b
The declared_refs feature, which is about to be merged into blead, gives Perl 5.26.0 experimental support for declaring a reference to a variable: my \$x; # equivalent to \my $x It is intended mainly for use in conjunction with refaliasing: my \$x = \$y; -- Father Chrysostomos
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 754b
On Sun, 17 Jul 2016 11:26:25 -0700, sprout wrote: Show quoted text
> The declared_refs feature, which is about to be merged into blead, > gives Perl 5.26.0 experimental support for declaring a reference to a > variable: > > my \$x; # equivalent to \my $x > > It is intended mainly for use in conjunction with refaliasing: > > my \$x = \$y;
The documentation: Beginning in v5.26.0, the referencing operator can come after C<my>, C<state>, C<our>, or C<local>. This syntax must be enabled with C<use feature 'declared_refs'>. It is experimental, and will warn by default unless C<no warnings 'experimental::refaliasing'> is in effect. implies you can do: local \&foo = \&bar; which you can't. Of course, the above is equivalent to: local *foo = \&bar; Tony


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org