take this little assembler program:

        new P1, .PerlArray
        set P1, 100
        bsr GETLEN
        
        set I0, P1[0]
        print "P1[0]="
        print I0
        print "\n"
        bsr GETLEN
        
        set I0, P1[10000]
        print "P1[10000]="
        print I0
        print "\n"      
        bsr GETLEN
        end
        
GETLEN:
        set I0, P1
        print "length="
        print I0
        print "\n"
        ret

it prints:

length=100
P1[0]=0
length=100
P1[10000]=0
length=10001

fetching an element out of bound changes the
length of the array. but should this really happen?
why does perlarray.pmc act like this:

        if (ix >= SELF->cache.int_val) {
            resize_array(interpreter, SELF, ix+1);
        }

instead of:

        if (ix >= SELF->cache.int_val) {
            value = pmc_new(INTERP, enum_class_PerlUndef);
            return value->vtable->get_integer(INTERP, value);
        }

are there any reason for this that I can't see or does it
just need a patch?

cheers,
Aldo

__END__
$_=q,just perl,,s, , another ,,s,$, hacker,,print;

Reply via email to