<div dir="ltr"><div>Hello,</div><div><br></div><div>For a WebKit observer like me:<br></div><div>* &quot;release&quot; - has a well-known meaning in Mac/Objective-C world. It&#39;s expected to &quot;free&quot; the memory. Same as COM&#39;s IUnknown::Release, but different from auto_ptr::release or unique_ptr::release (which don&#39;t free the memory).</div><div>* &quot;move&quot; - has a well-known meaning in C++ 11 world. Different from &quot;release&quot; above. If I see methods &quot;move&quot; and &quot;release&quot; and they do the same, I will have to learn and understand that trick.</div><div>* &quot;take&quot; - a typical name for collections like a blocking queue, heap and some others (usually ordered). If it&#39;s a collection&#39;s method, it&#39;s logically expected to return an item. The key distinction between fred.takeCandy() and say bowl.takeCandy() is that bowl is passive. We treat bowl as a passive bag of data, and expect others to take from it. It&#39;s pretty easy to understand and remember, it makes intention more clear than say &quot;bowl.removeCandy()&quot;.</div><div>Pure OOP style is always the right way when it comes to readability. A good example mentioned by Stroustrup once that it should be sqrt(5), not 5.sqrt(). Maybe &quot;bowl.takeCandy&quot; is a good compromise to keep it as a method (instead of a global &quot;TakeCandyFromBowl(bowl)&quot;).</div><div><br></div><div>Naming is fun.</div><div><br></div><div>--</div><div>Daniel</div><div><a href="https://twitter.com/battlmonstr">https://twitter.com/battlmonstr</a></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 5, 2016 at 9:00 PM,  <span dir="ltr">&lt;<a href="mailto:webkit-dev-request@lists.webkit.org" target="_blank">webkit-dev-request@lists.webkit.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Send webkit-dev mailing list submissions to<br>
        <a href="mailto:webkit-dev@lists.webkit.org">webkit-dev@lists.webkit.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="https://lists.webkit.org/mailman/listinfo/webkit-dev" rel="noreferrer" target="_blank">https://lists.webkit.org/<wbr>mailman/listinfo/webkit-dev</a><br>
or, via email, send a message with subject or body &#39;help&#39; to<br>
        <a href="mailto:webkit-dev-request@lists.webkit.org">webkit-dev-request@lists.<wbr>webkit.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:webkit-dev-owner@lists.webkit.org">webkit-dev-owner@lists.webkit.<wbr>org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than &quot;Re: Contents of webkit-dev digest...&quot;<br>
<br>
<br>
Today&#39;s Topics:<br>
<br>
   1. Terminology for giving up ownership: take, release,       move<br>
      (Darin Adler)<br>
   2. Re: Terminology for giving up ownership: take, release, move<br>
      (Filip Pizlo)<br>
<br>
<br>
------------------------------<wbr>------------------------------<wbr>----------<br>
<br>
Message: 1<br>
Date: Mon, 05 Sep 2016 10:13:28 -0700<br>
From: Darin Adler &lt;<a href="mailto:darin@apple.com">darin@apple.com</a>&gt;<br>
To: WebKit Development Mailing List &lt;<a href="mailto:webkit-dev@lists.webkit.org">webkit-dev@lists.webkit.org</a>&gt;<br>
Subject: [webkit-dev] Terminology for giving up ownership: take,<br>
        release,        move<br>
Message-ID: &lt;<a href="mailto:3AD4BD53-7CC2-4F26-8D3D-B3631413B796@apple.com">3AD4BD53-7CC2-4F26-8D3D-<wbr>B3631413B796@apple.com</a>&gt;<br>
Content-Type: text/plain; charset=utf-8<br>
<br>
Hi folks.<br>
<br>
WebKit has some critical functions that involve asking an object to give up ownership of something so the caller can take ownership.<br>
<br>
In the C++ standard library itself, this is called move, as in std::move.<br>
<br>
In WebKit smart pointers, we call this operation release, as in RefPtr::releaseNonNull and String::releaseImpl.<br>
<br>
In WebKit collections, we call this operation take, as in HashMap::take and ExceptionOr::takeReturnValue.<br>
<br>
The release vs. take terminology is distracting to my eyes. The verb ?take&quot; states what the caller wishes to do, and the verb ?release? states what the caller wants the collection or smart pointer to do. My first thought was be to rename the take functions to use the word release instead, but I fear it might make them harder to understand instead of easier and clearly it would make them longer.<br>
<br>
Does anyone have other ideas on how to collapse WebKit project terminology down so we don?t have three different single words that are used to mean almost the same thing?<br>
<br>
? Darin<br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Mon, 05 Sep 2016 10:23:35 -0700<br>
From: Filip Pizlo &lt;<a href="mailto:fpizlo@apple.com">fpizlo@apple.com</a>&gt;<br>
To: Darin Adler &lt;<a href="mailto:darin@apple.com">darin@apple.com</a>&gt;<br>
Cc: WebKit Development &lt;<a href="mailto:webkit-dev@lists.webkit.org">webkit-dev@lists.webkit.org</a>&gt;<br>
Subject: Re: [webkit-dev] Terminology for giving up ownership: take,<br>
        release, move<br>
Message-ID: &lt;<a href="mailto:8C068BFC-10D2-4388-919A-761CA9323EAB@apple.com">8C068BFC-10D2-4388-919A-<wbr>761CA9323EAB@apple.com</a>&gt;<br>
Content-Type: text/plain; charset=utf-8<br>
<br>
<br>
&gt; On Sep 5, 2016, at 10:13 AM, Darin Adler &lt;<a href="mailto:darin@apple.com">darin@apple.com</a>&gt; wrote:<br>
&gt;<br>
&gt; Hi folks.<br>
&gt;<br>
&gt; WebKit has some critical functions that involve asking an object to give up ownership of something so the caller can take ownership.<br>
&gt;<br>
&gt; In the C++ standard library itself, this is called move, as in std::move.<br>
&gt;<br>
&gt; In WebKit smart pointers, we call this operation release, as in RefPtr::releaseNonNull and String::releaseImpl.<br>
&gt;<br>
&gt; In WebKit collections, we call this operation take, as in HashMap::take and ExceptionOr::takeReturnValue.<br>
&gt;<br>
&gt; The release vs. take terminology is distracting to my eyes. The verb ?take&quot; states what the caller wishes to do, and the verb ?release? states what the caller wants the collection or smart pointer to do. My first thought was be to rename the take functions to use the word release instead, but I fear it might make them harder to understand instead of easier and clearly it would make them longer.<br>
&gt;<br>
&gt; Does anyone have other ideas on how to collapse WebKit project terminology down so we don?t have three different single words that are used to mean almost the same thing?<br>
<br>
The use of &quot;take&quot; for these methods grinds my gears, for the same reason you were distracted: &quot;take&quot; describes the desires of the caller, but that doesn&#39;t work for me because I read &quot;fred.makeCoffee()&quot; as &quot;makeCoffee()&quot; being an imperative verb phrase and &quot;fred&quot; as being the subject that will make me the coffee.  So, &quot;HashMap::take&quot; means to me that the HashMap is taking something from me, rather than releasing something to me.<br>
<br>
I wonder if there is anyone who is surprised more by release than by take, and who would find it strange to say ExceptionOr::<wbr>releaseReturnValue.<br>
<br>
I wouldn&#39;t want any words other than &quot;release&quot; used for this purpose, because I know exactly what to expect &quot;release&quot; to mean, since we use it so much already.  I think that would be even worse than sometimes using &quot;take&quot;, because even though &quot;takeReturnValue&quot; is annoying, I&#39;ve learned to know what it means.<br>
<br>
If there isn&#39;t anyone who prefers take, maybe we should just rename &quot;take&quot; to &quot;release&quot; in these cases?<br>
<br>
-Filip<br>
<br>
<br>
&gt;<br>
&gt; ? Darin<br>
&gt; ______________________________<wbr>_________________<br>
&gt; webkit-dev mailing list<br>
&gt; <a href="mailto:webkit-dev@lists.webkit.org">webkit-dev@lists.webkit.org</a><br>
&gt; <a href="https://lists.webkit.org/mailman/listinfo/webkit-dev" rel="noreferrer" target="_blank">https://lists.webkit.org/<wbr>mailman/listinfo/webkit-dev</a><br>
<br>
<br>
<br>
------------------------------<br>
<br>
______________________________<wbr>_________________<br>
webkit-dev mailing list<br>
<a href="mailto:webkit-dev@lists.webkit.org">webkit-dev@lists.webkit.org</a><br>
<a href="https://lists.webkit.org/mailman/listinfo/webkit-dev" rel="noreferrer" target="_blank">https://lists.webkit.org/<wbr>mailman/listinfo/webkit-dev</a><br>
<br>
<br>
End of webkit-dev Digest, Vol 136, Issue 3<br>
******************************<wbr>************<br>
</blockquote></div><br></div></div>