Closed Bug 1689218 Opened 5 years ago Closed 4 years ago

Consolidate nsBaseHashtable::MaybeGet and GetAndRemove

Categories

(Core :: XPCOM, task, P3)

task

Tracking

()

RESOLVED FIXED
88 Branch
Tracking Status
firefox88 --- fixed

People

(Reporter: janv, Assigned: sg)

Details

Attachments

(1 file)

This has been raised in https://phabricator.services.mozilla.com/D99428

"If we stick with GetAndRemove as the name of the other method, then MaybeGet should also be Get (and that should replace the existing Get which doesn't return a Maybe).

Alternatively, both methods should be named something with Maybe.

A third alternative might be to make the result type dependent on the UserDataType: If the UserDataType is default-constructible, both Get/GetAndRemove would return UserDataType, otherwise Maybe<UserDataType> (and we wouldn't need any methods named Maybe)."

I will provide a patch to rename GetAndRemove to Extract, analogous to Maybe::extract.

Assignee: nobody → sgiesecke

First, it should be called "Lookup" rather than "Get" because it returns
DataType (rather than UserDataType), but that would still be confusing,
since as opposed to other Lookup* methods, it does not return a DataType&
(and obviously, it can't). So "Extract" seems to be a better name, cf.
mozilla::Maybe::extract.

Depends on D105470

Pushed by sgiesecke@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/dbb46f16e00f Rename nsBaseHashtable::GetAndRemove to Extract. r=necko-reviewers,dragana
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 88 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: