Consolidate nsBaseHashtable::MaybeGet and GetAndRemove
Categories
(Core :: XPCOM, task, P3)
Tracking
()
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)."
Assignee | ||
Comment 1•4 years ago
|
||
I will provide a patch to rename GetAndRemove
to Extract
, analogous to Maybe::extract
.
Assignee | ||
Comment 2•4 years ago
|
||
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
Comment 4•4 years ago
|
||
bugherder |
Description
•