Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[perl #33641] Deleting keys from an OrderedHash

7 views
Skip to first unread message

Simon Glover

unread,
Jan 1, 2005, 7:13:17 PM1/1/05
to bugs-bi...@rt.perl.org
# New Ticket Created by Simon Glover
# Please include the string: [perl #33641]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=33641 >

This code:

new P0, .OrderedHash
set P0["foo"], "Foo"
delete P0["foo"]
exists I0, P0[0]
print I0
exists I0, P0["foo"]
print I0
end

prints '10', while this:

new P0, .OrderedHash
set P0["foo"], "Foo"
delete P0[0]
exists I0, P0[0]
print I0
exists I0, P0["foo"]
print I0
end

prints '01'. In both cases, I would expect to get '00', since the hash
should be empty. Is this a bug in the code, or is an OrderedHash supposed
to work this way (in which case a note to this effect in the
documentation might be a good idea)?

Simon


Leopold Toetsch

unread,
Jan 2, 2005, 6:20:02 AM1/2/05
to perl6-i...@perl.org
Simon Glover <parrotbug...@parrotcode.org> wrote:

> ... In both cases, I would expect to get '00', since the hash


> should be empty. Is this a bug in the code, or is an OrderedHash supposed
> to work this way (in which case a note to this effect in the
> documentation might be a good idea)?

Mixing keyed and indexed access in OrderedHash isn't working. So unless
the implementation is fixed a note WRT that is really in order.
We could also throw an exeception in delete_keyed for now.

> Simon

leo

0 new messages