#538: NQP list initializers
-------------------+--------------------------------------------------------
Reporter: bsdz | Type: bug
Status: new | Priority: normal
Milestone: | Component: nqp
Version: trunk | Severity: medium
Keywords: | Lang:
Patch: | Platform: all
-------------------+--------------------------------------------------------
When a list is declared in NQP with only one element a scalar is created.
i.e, the following nqp script: -
{{{
load_bytecode('library/dumper.pbc');
my @my_list := (10);
_dumper(@my_list, 'my_list');
}}}
displays: -
{{{
"my_list" => 10
}}}
when it should show: -
{{{
"my_list" => ResizablePMCArray (size:1) [
10
]
}}}
A workaround is to place a dummy element and shift it. i.e.
{{{
my @my_list := ('dummy', 10);
@my_list.shift();
_dumper(@my_list, 'my_list');
}}}
--
Ticket URL: <https://trac.parrot.org/parrot/ticket/538>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets