Perhaps also worth noting that this applies to other holes as well, e.g. those created by extending an array:
my @a = 42; @a[5] = 49; say |@a # 42(Mu)(Mu)(Mu)(Mu)49 In fact, this the actual problem the user had. On 2017-07-22 18:52:03, c...@zoffix.com wrote: > On Sat, 22 Jul 2017 18:48:38 -0700, c...@zoffix.com wrote: > > The current behaviour kinda makes sense when you squint at it, but > > today we had a user[^1]who was surprised by it, so I'm filing it as a > > ticket, if maybe there's some Better Way this can be done with. > > > > When you :delete an element from the Array, you get nqp::null stuffed > > into the position, which gets converted to `is default` value when > > you > > look it up again: > > > > <Zoffix__> m: use nqp; my @a is default(42) = <a b c>; @a[1]:delete; > > dd @a > > <camelia> rakudo-moar b14721: OUTPUT: «Array @a = ["a", 42, "c"]» > > > > However, if you now convert that Array to a Slip or a List, the hole > > is left as a bare Mu and doesn't get turned into a default value, > > which is lost: > > > > <Zoffix__> m: use nqp; my @a is default(42) = <a b c>; @a[1]:delete; > > dd @a.Slip > > <camelia> rakudo-moar b14721: OUTPUT: «slip("a", Mu, "c")» > > > > <Zoffix__> m: use nqp; my @a is default(42) = <a b c>; @a[1]:delete; > > dd @a.List > > <camelia> rakudo-moar b14721: OUTPUT: «("a", Mu, "c")» > > > > So it makes sense that without `is default` you don't get an `is > > default` value, but at the same time, Mu is not a great value to deal > > with... > > > > [1] https://irclog.perlgeek.de/perl6/2017-07-22#i_14908846 > > > And actually both .flat and .Seq do get `is default` value instead of > Mu, so at the very least there's some inconsistency here: > > <Zoffix__> m: use nqp; my @a is default(42) = <a b c>; @a[1]:delete; > dd @a.flat > <camelia> rakudo-moar b14721: OUTPUT: «("a", 42, "c").Seq» > <Zoffix__> m: use nqp; my @a is default(42) = <a b c>; @a[1]:delete; > dd @a.Seq > <camelia> rakudo-moar b14721: OUTPUT: «("a", 42, "c").Seq»