Just stumbled across this, but I can't tell from S09 if this is a bug or
feature:
$ ./perl6 -e 'my %foo; if %foo<a> {}; say %foo.perl'
{"a" => undef}
I wasn't expecting auto-vivification there. The examples in S09 use HoH
instead of a flat hash:
But these bindings do autovivify:
my %hash;
my $val := %hash<foo><bar>;
my @array;
my $cap = \...@array[0][0]; # $cap is a Capture object ‐ see S02
my :($obj) := $cap; # @array[0][0] created here
my @array;
foo(@array[0][0]);
sub foo ($obj is rw) {...} # same thing, basically
my %hash;
%hash<foo><bar> = "foo"; # duh
So is this a bug?
Revision: 34706
$ uname -a
Darwin curtis-poes-computer-3.local 9.5.1 Darwin Kernel Version 9.5.1: Fri Sep
19 16:19:24 PDT 2008; root:xnu-1228.8.30~1/RELEASE_I386 i386
Cheers,
Ovid
--
Buy the book - http://www.oreilly.com/catalog/perlhks/
Tech blog - http://use.perl.org/~Ovid/journal/
Twitter - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6