On Sat, 09 Sep 2017 19:53:53 -0700, tomentiru...@gmail.com wrote:
> > my @h is default([])
> []
> > @h[0].push: 3
> [3]
> > @h
> []
> > @h[0]
> [3]
> 
> > my %h is default({})
> {}
> > %h<a><b> = 3
> 3
> > %h
> {}
> > %h<a>
> {b => 3}
> 
> The array/hash variable's default is an empty array/hash literal. If
> an element is autovivified, it can be accessed directly, but isn’t
> findable from the variable.

While I suspect this can be fixed (and is missing setup of the auto-viv 
callback on the codepath for setting up a default), note that `is default` is a 
trait, it is evaluated at compile time. Thus there is one single array that 
will be shared globally and assigned into all elements, which probably isn't 
what you wanted.

/jnthn

Reply via email to