develooper Front page | perl.perl5.porters | Postings from July 2013

postfix dereference ideas

Thread Next
From:
mucker
Date:
July 10, 2013 16:16
Subject:
postfix dereference ideas
Message ID:
20130710161545.140530@gmx.com
A long time ago,

http://www.nntp.perl.org/group/perl.perl6.language/2000/08/msg2714.html

> my $x = [1, 2, 3];
> $x->@
1, 2, 3
> $x->@[1, 2]
2, 3

> $x->@ = (1, 2, 3)
1, 2, 3
> $x->@[1] = (1, 2, 3)
1,1,2,3,3

% is similar for hashes

For code refs's we already have ->()
For scalar refs ->$ is needed
For globrefs ->*$, ->*@, ->*%, ->**

If autobox box is in Core, and we can have wordier versions of the above, which is rubyish and fine.

I always find postfix more intuitive, so I am +1 for this feature.

-mucker

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About