FAQ
In perl.git, the branch sprout/mywack has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/4ffb6d5991dd1c33e0a67050ff06bc476c2074fb?hp=e9d46eee3285f7df2c960d1b21508c5fde08071a>

- Log -----------------------------------------------------------------
commit 4ffb6d5991dd1c33e0a67050ff06bc476c2074fb
Author: Father Chrysostomos <sprout@cpan.org>
Date: Sun May 29 16:02:53 2016 -0700

     perldiag entries for declared_refs

M pod/perldiag.pod

commit dc0fe8397b973bee4e1d89a7220461d80370786e
Author: Father Chrysostomos <sprout@cpan.org>
Date: Sun May 29 14:32:11 2016 -0700

     Clearer declared_refs warning msg

M op.c
M toke.c

commit 51268847a6bca5d4f36fc09ab2ec3eefa4f037de
Author: Father Chrysostomos <sprout@cpan.org>
Date: Sun May 29 14:29:28 2016 -0700

     Update docs for declared_refs

M lib/feature.pm
M pod/perlexperiment.pod
M pod/perlref.pod
M regen/feature.pl
-----------------------------------------------------------------------

Summary of changes:
  lib/feature.pm | 16 ++++++++++++++++
  op.c | 6 ++----
  pod/perldiag.pod | 20 ++++++++++++++++++++
  pod/perlexperiment.pod | 12 ++++++++++++
  pod/perlref.pod | 20 ++++++++++++++++++++
  regen/feature.pl | 16 ++++++++++++++++
  toke.c | 3 +--
  7 files changed, 87 insertions(+), 6 deletions(-)

diff --git a/lib/feature.pm b/lib/feature.pm
index ddab733..5524e5b 100644
--- a/lib/feature.pm
+++ b/lib/feature.pm
@@ -355,6 +355,22 @@ See L<perlop/Bitwise String Operators> for details.

  This feature is available from Perl 5.22 onwards.

+=head2 The 'declared_refs' feature
+
+B<WARNING>: This feature is still experimental and the implementation may
+change in future versions of Perl. For this reason, Perl will
+warn when you use the feature, unless you have explicitly disabled the
+warning:
+
+ no warnings "experimental::declared_refs";
+
+This allows a reference to a variable to be declared with C<my>, C<state>,
+our C<our>, or localized with C<local>. It is intended mainly for use in
+conjunction with the "refaliasing" feature. See L<perlref/Declaring a
+Reference to a Variable> for examples.
+
+This feature is available from Perl 5.26 onwards.
+
  =head1 FEATURE BUNDLES

  It's possible to load multiple features together, using
diff --git a/op.c b/op.c
index be210b3..e3e0a89 100644
--- a/op.c
+++ b/op.c
@@ -3120,8 +3120,7 @@ Perl_op_lvalue_flags(pTHX_ OP *o, I32 type, U32 flags)
       "feature is not enabled");
       Perl_ck_warner_d(aTHX_
         packWARN(WARN_EXPERIMENTAL__DECLARED_REFS),
- "Reference constructors after declarators are "
- "experimental");
+ "Declaring references is experimental");
       op_lvalue(cUNOPo->op_first, OP_NULL);
       return o;
   }
@@ -3705,8 +3704,7 @@ S_my_kid(pTHX_ OP *o, OP *attrs, OP **imopsp)
          "feature is not enabled");
   Perl_ck_warner_d(aTHX_
        packWARN(WARN_EXPERIMENTAL__DECLARED_REFS),
- "Reference constructors after declarators are "
- "experimental");
+ "Declaring references is experimental");
   /* Kid is a nulled OP_LIST, handled above. */
   my_kid(cUNOPo->op_first, attrs, imopsp);
      }
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index fdf79c8..a425a24 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -1877,6 +1877,18 @@ valid magic number.
  you have also specified an explicit size for the string. See
  L<perlfunc/pack>.

+=item Declaring references is experimental
+
+(S experimental::declared_refs) This warning is emitted if you use
+a reference constructor on the right-hand side of C<my>, C<state>, C<our>, or
+C<local>. Simply suppress the warning if you want to use the feature, but
+know that in doing so you are taking the risk of using an experimental
+feature which may change or be removed in a future Perl version:
+
+ no warnings "experimental::declared_refs";
+ use feature "declared_refs";
+ $fooref = my \$foo;
+
  =for comment
  The following are used in lib/diagnostics.t for testing two =items that
  share the same description. Changes here need to be propagated to there
@@ -5860,6 +5872,14 @@ think the U.S. Government thinks it's a secret, or at least that they
  will continue to pretend that it is. And if you quote me on that, I
  will deny it.

+=item The experimental declared_refs feature is not enabled
+
+(F) To declare references to variables, as in C<my \%x>, you must first enable
+the feature:
+
+ no warnings "experimental::declared_refs";
+ use feature "declared_refs";
+
  =item The %s function is unimplemented

  (F) The function indicated isn't implemented on this architecture,
diff --git a/pod/perlexperiment.pod b/pod/perlexperiment.pod
index 2e33177..f289e53 100644
--- a/pod/perlexperiment.pod
+++ b/pod/perlexperiment.pod
@@ -120,6 +120,18 @@ L<[perl #119453]|https://rt.perl.org/rt3/Ticket/Display.html?id=119453>.

  See also L<perlrun>

+=item Declaring a reference to a variable
+
+Introduced in Perl 5.26.0
+
+Using this feature triggers warnings in the category
+C<experimental::declared_refs>.
+
+The ticket for this feature is
+L<[perl #xxxxxx]|https://rt.perl.org/rt3/Ticket/Display.html?id=xxxxxx>.
+
+See also: L<perlref/Declaring a Reference to a Variable>
+
  =item There is an C<installhtml> target in the Makefile.

  The ticket for this feature is
diff --git a/pod/perlref.pod b/pod/perlref.pod
index 8959ba5..a071f1f 100644
--- a/pod/perlref.pod
+++ b/pod/perlref.pod
@@ -909,6 +909,26 @@ will only be visible within that inner sub, and will not affect the outer
  subroutine where the variables are declared. This bizarre behavior is
  subject to change.

+=head1 Declaring a Reference to a Variable
+
+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 war ... [76 chars truncated]
+
+This feature makes these:
+
+ my \$x;
+ our \$y;
+
+equivalent to:
+
+ \my $x;
+ \our $x;
+
+It is intended mainly for use in assignments to references (see
+L</Assigning to References>, above). It also allows the backslash to be
+used on just some items in a list of declared variables:
+
+ my ($foo, \@bar, \%baz); # equivalent to: my $foo, \my(@bar, %baz);
+
  =head1 SEE ALSO

  Besides the obvious documents, source code can be instructive.
diff --git a/regen/feature.pl b/regen/feature.pl
index 78c7400..92655da 100755
--- a/regen/feature.pl
+++ b/regen/feature.pl
@@ -665,6 +665,22 @@ See L<perlop/Bitwise String Operators> for details.

  This feature is available from Perl 5.22 onwards.

+=head2 The 'declared_refs' feature
+
+B<WARNING>: This feature is still experimental and the implementation may
+change in future versions of Perl. For this reason, Perl will
+warn when you use the feature, unless you have explicitly disabled the
+warning:
+
+ no warnings "experimental::declared_refs";
+
+This allows a reference to a variable to be declared with C<my>, C<state>,
+our C<our>, or localized with C<local>. It is intended mainly for use in
+conjunction with the "refaliasing" feature. See L<perlref/Declaring a
+Reference to a Variable> for examples.
+
+This feature is available from Perl 5.26 onwards.
+
  =head1 FEATURE BUNDLES

  It's possible to load multiple features together, using
diff --git a/toke.c b/toke.c
index 3d32555..7abc730 100644
--- a/toke.c
+++ b/toke.c
@@ -7806,8 +7806,7 @@ Perl_yylex(pTHX)
           "feature is not enabled");
    Perl_ck_warner_d(aTHX_
         packWARN(WARN_EXPERIMENTAL__DECLARED_REFS),
- "Reference constructors after declarators are "
- "experimental");
+ "Declaring references is experimental");
       }
       OPERATOR(MY);


--
Perl5 Master Repository

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupperl5-changes @
categoriesperl
postedMay 30, '16 at 12:08a
activeMay 30, '16 at 12:08a
posts1
users1
websiteperl.org

1 user in discussion

Father Chrysostomos: 1 post

People

Translate

site design / logo © 2018 Grokbase