Ticket #813 (closed RFC: done)

Opened 5 years ago

Last modified 4 years ago

[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

Change History

follow-up: ↓ 2   Changed 5 years ago by coke

My recommendation would be to deprecate the entire thing before 1.4 and remove it immediately after.

in reply to: ↑ 1   Changed 5 years ago by bacek

Replying to coke:

My recommendation would be to deprecate the entire thing before 1.4 and remove it immediately after.

Unfortunately OrderedHash used for Namespaces (and DynPMCs afaik). Thats why I propose to reduce OrderedHash functionality to currently used scope.

OTOH, we can treat it as deprecating of OrderedHash at all and put some small, non-public PMC as per step 4: "put big warning message".

-- Bacek

  Changed 4 years ago by bacek

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

Hello.

OrderedHash was reimplemented after 2.0 release. OH.push_foo functions can be deprecated/removed later (if desired). Closing ticket.

-- Bacek

Note: See TracTickets for help on using tickets.