<tadzik> don't know about nqp, but on JVM we keep a constant value in 
QRPA which says how many elements are there
<tadzik> it probably needs to be updated when we set Mu somewhere
<moritz> the problem is that if you delete an element that's not the 
last, it set to Mu
<moritz> because we don't have an offchannel way to store an array 
element as deleted
<pmurias> no
<moritz> no?
<tadzik> we have to settle of something: do we count the number of 
defined elements in the array, or do we count "the longest streak" of 
elements?
<pmurias> the problem is that if you delete the last element all the 
undefined elements before it get deletedf
<moritz> r: my @a = <a b c d>; @a.delete(2); say @a.perl
<p6eval> rakudo 4fb07b: OUTPUT«Array.new("a", "b", Any, "d")␤»
<moritz> tadzik: or do we simply keep the count separate, and don't do 
any magic
<moritz> pmurias: I'm (nearly) sure there's a spectest that requires 
that
<pmurias> r: class Foo {};my $foo = [0,1,2,3,4];say $foo.elems;$foo[4] = 
Foo;$foo[3] = Foo;say $foo.elems;$foo.delete(4);say $foo.elems;
<p6eval> rakudo 4fb07b: OUTPUT«5␤5␤3␤»
<pmurias> moritz: it seems to be a bug in the code
<moritz> fwiw I agree that's undesirable
<moritz> but I can't quite imagine that it happened without any 
intention
* masak adds this to the ticket
<pmurias> the spec seems to hold an distinction between elements that 
aren't in an array and those that are set to an undefined value

Reply via email to