Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Unifying namespaces of @name and $name to simplify dereferencing? (experimental::refaliasing)(updated examples)

by LanX (Saint)
on Mar 26, 2016 at 12:21 UTC ( [id://1158825]=note: print w/replies, xml ) Need Help??


in reply to Re: Unifying namespaces of @name and $name to simplify dereferencing?
in thread Unifying namespaces of @name and $name to simplify dereferencing?

Oh thanks that's indeed interesting, Perl core finally allowing aliasing of lexicals! :)

... not sure if it solves the all issues yet...

But you know these new possibilities deserve a proper thread ...

update
hmm ... coupling is broken after assigning a new ref

use 5.22.0; use feature qw/say refaliasing/; no warnings "experimental::refaliasing"; \my @a = my $a = [666]; say "noref: $a[0], ref: $a->[0], list: @a"; $a = [42]; say "noref: $a[0], ref: $a->[0], list: @a";
-->
noref: 666, ref: 666, list: 666 noref: 666, ref: 42, list: 666

update

at least passing arrays to arrays is possible now

use 5.22.0; use feature qw/say refaliasing/; no warnings "experimental::refaliasing"; my @a = (666,42); test (\@a,\@a); sub test { (\my @sub, my $ref) = @_; say "noref: $sub[0], ref: $ref->[0], list: @sub"; }
-->
noref: 666, ref: 666, list: 666 42

well the syntax when passing more than one argument is not very elegant, see duplicated my ... but at least it's consistent.

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

  • Comment on Re^2: Unifying namespaces of @name and $name to simplify dereferencing? (experimental::refaliasing)(updated examples)
  • Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1158825]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2024-04-19 02:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found