Ticket #813 (closed RFC: done)
[RFC] Deprecate (parts) of OrderedHash.
Reported by: | bacek | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | core | Version: | 1.3.0 |
Severity: | medium | Keywords: | |
Cc: | Language: | ||
Patch status: | Platform: |
Description
Hello.
Current implementation of OrderedHash is hack over Hash which has few design flows:
1. It relies on particular Hash implementation.
2. It "leaks" Hash buckets during removal.
3. It breaks LSP for integer keys.
4. It implements methods such "push_pmc" which doesn't make sense for Hash.
My proposal is:
1. Rename it to something like "Dictionary" or "LookupTable".
2. Change it to "has-a Hash" instead of "is-a Hash". Just to prevent assumptions about contract.
3. Disallow removal of keys (because currently inside Parrot we never remove keys from OrderedHash). It will simplify guts and allow to remove hack with "bucket leak".
4. (Optional) Put big warning message "Internal use only, enter on your own risk".
-- Bacek