On Fri, Jul 3, 2015 at 11:26 AM, Tom Browder <tom.brow...@gmail.com> wrote:

> # method 1
> my %hash1;
> foo1(%hash1);
> say %hash1.perl;
> sub foo1(%hash) {
>   %hash{1} = 0;
> }
>

This is what I would naïvely expect to work in any language except Perl 5.


> # method 2
> my %hash2;
> my $href2 = %hash2;
> foo2($href2);
> say %hash2.perl;
> sub foo2($href) {
>   $href{1} = 0;
> }
>
> # this is what I naively tried first
> # method 3 [DOESN'T WORK]
> my %hash3;
> my $href3 = \%hash3;
> foo3($href3);
> say %hash3.perl;
> sub foo3($href) {
>   %($href}){1} = 0;
> }
>

These both --- especially the latter --- smell of Perl 5 experience. :) But
Perl 5 using refs to pass things like arrays or hashes without flattening
them is an outright (and acknowledged) hack; other languages don't require
such hacks. It will be a stumbling block for Perl 5 programmers, though.

Perl 6 community: Given that captures are not expected to be used directly
most of the time, is there any chance that rakudo could issue a perl5-ism
warning when it sees \ followed by a sigil?

-- 
brandon s allbery kf8nh                               sine nomine associates
allber...@gmail.com                                  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net

Reply via email to