#1295: Should FixedPMCArray autovivify nested arrays on set_*keyed()?
-------------------------+--------------------------------------------------
 Reporter:  whiteknight  |       Owner:       
     Type:  cage         |      Status:  new  
 Priority:  normal       |   Milestone:  1.9  
Component:  core         |     Version:  1.7.0
 Severity:  medium       |    Keywords:       
     Lang:               |       Patch:       
 Platform:               |  
-------------------------+--------------------------------------------------
 (From RT #46675)

 Here is an example of code:
 {{{
 VTABLE void set_pmc_keyed(PMC *key, PMC *value) {
         const INTVAL k = VTABLE_get_integer(INTERP, key);
         PMC   *nextkey = key_next(INTERP, key);

         if (!nextkey) {
             SELF.set_pmc_keyed_int(k, value);
         }
         else {
             PMC *box = SELF.get_pmc_keyed_int(k);

             /* RT #46675: autovivify an Array and insert it in SELF */
             if (!box)
                 box = pmc_new(INTERP, SELF.type());

             VTABLE_set_pmc_keyed(INTERP, box, nextkey, value);
         }
     }
 }}}

 It's clear from the code above that if the element at SELF[k] doesn't
 exist, that a new array is created, but that new array is never inserted
 into SELF. So the question is this: What is the expected autovivification
 behavior of FixedPMCArray (and, by extension, the other Fixed*Array
 types)?

-- 
Ticket URL: <https://trac.parrot.org/parrot/ticket/1295>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets

Reply via email to