Ticket #539 (closed bug: fixed)

Opened 13 years ago

Last modified 12 years ago

NQP does not autovivify "our @" but does for "my @"

Reported by: bsdz Owned by:
Priority: normal Milestone:
Component: nqp Version: trunk
Severity: medium Keywords:
Cc: pmichaud Language:
Patch status: Platform: all

Description

When declaring a list using "my" NQP autovifies whereas with "our" it does not.

i.e.

load_bytecode('library/dumper.pbc');

our @our_list;
@our_list.push('some data');
_dumper(@our_list, 'our_list');

my @my_list;
@my_list.push('some data');
_dumper(@my_list, 'my_list');

outputs :-

"our_list" => ResizablePMCArray (size:0) [
]
"my_list" => ResizablePMCArray (size:1) [
    "some data"
]

whereas one should expect: -

"our_list" => ResizablePMCArray (size:1) [
    "some data"
]
"my_list" => ResizablePMCArray (size:1) [
    "some data"
]

A workaround is to declare an "our" scoped list as follows: -

our @our_list := ('dummy' , 'dummy');
@our_list.shift();
@our_list.shift();
@our_list.push('some data');
_dumper(@our_list, 'our_list');


Change History

Changed 12 years ago by jkeenan

  • cc pmichaud added

Patrick,

Can you comment on the issues raised in this ticket?

Thank you very much.
kid51

Changed 12 years ago by pmichaud

  • status changed from new to closed
  • resolution set to fixed

Now fixed in nqp-rx.

Pm

Note: See TracTickets for help on using tickets.