[webkit-dev] Terminology for giving up ownership: take, release, move
Michael Catanzaro
mcatanzaro at igalia.com
Tue Sep 6 07:01:24 PDT 2016
On Mon, 2016-09-05 at 10:23 -0700, Filip Pizlo wrote:
> The use of "take" for these methods grinds my gears, for the same
> reason you were distracted: "take" describes the desires of the
> caller, but that doesn't work for me because I read
> "fred.makeCoffee()" as "makeCoffee()" being an imperative verb phrase
> and "fred" as being the subject that will make me the coffee. So,
> "HashMap::take" means to me that the HashMap is taking something from
> me, rather than releasing something to me.
>
> I wonder if there is anyone who is surprised more by release than by
> take, and who would find it strange to say
> ExceptionOr::releaseReturnValue.
I'm more used to seeing "release" used with smart pointers and "take"
used with data structures, but I like your argument that the semantics
of "take" are backwards. "Release" is clear in either case.
Michael
More information about the webkit-dev
mailing list