[webkit-dev] Terminology for giving up ownership: take, release, move
Darin Adler
darin at apple.com
Tue Sep 6 17:27:25 PDT 2016
> On Sep 6, 2016, at 4:48 PM, Maciej Stachowiak <mjs at apple.com> wrote:
>
> STL smart pointers have a 0-argument reset for non-returning remove instead, and convention seems to be to use swap() or move() for the returning remove on a smart pointer. So an alternate possibility would be to use the above convention for collections, but make smart pointers have no remove+get operation at all.
Our modern smart pointers follow the standard library convention you mention above.
It’s the peculiar cases that need names, such as:
“assert this RefPtr is non-null to turn it into a Ref&&”, currently named releaseNonNull
“release the RefPtr inside the String”, currently named releaseImpl(), but another possibility would be to have impl() be RefPtr<StringImpl>& instead of a StringImpl*, so you could do move(string.impl()) instead of string.releaseImpl().
— Darin
More information about the webkit-dev
mailing list