Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EXPERIMENT] reference syntax in variable declaration #15458

Open
p5pRT opened this issue Jul 17, 2016 · 4 comments
Open

[EXPERIMENT] reference syntax in variable declaration #15458

p5pRT opened this issue Jul 17, 2016 · 4 comments
Labels
experiment ticket tracking an active experiment

Comments

@p5pRT
Copy link

p5pRT commented Jul 17, 2016

Migrated from rt.perl.org#128654 (status was 'open')

Searchable as RT128654$

@p5pRT
Copy link
Author

p5pRT commented Jul 17, 2016

From @cpansprout

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

@p5pRT
Copy link
Author

p5pRT commented May 15, 2019

From @tonycoz

On Sun, 17 Jul 2016 11​:26​:25 -0700, sprout wrote​:

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

@p5pRT
Copy link
Author

p5pRT commented May 15, 2019

The RT System itself - Status changed from 'new' to 'open'

@rjbs rjbs added experiment ticket tracking an active experiment and removed type-meta Severity Low labels Apr 30, 2021
@rjbs rjbs changed the title [EXPERIMENT] Declared references [EXPERIMENT] reference syntax in variable declaration Apr 30, 2021
@richardleach
Copy link
Contributor

Currently doesn't work with state: #19927
(Seems possible to make if do so, but the wrong optree is generated at present.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
experiment ticket tracking an active experiment
Projects
None yet
Development

No branches or pull requests

3 participants