Re: [webkit-dev] Terminology for giving up ownership: take, release, move

2016-09-05 Thread Alfonso Guerra
Is it imperative to restrict the choices to the current nomenclature?

If you're finding it difficult to pick from among them, perhaps a glance
through Dictionary's thesaurus will help. Something like cede, yield, or
relinquish? and for the counterpart perhaps manage, contain, hold or
another synonym?


Alfonso Guerra
Founder/CEO
Apokalypse Software Corp.
(626) 667-4285




On Mon, Sep 5, 2016 at 7:22 PM, Maciej Stachowiak  wrote:

>
> On Sep 5, 2016, at 3:30 PM, Dan Bernstein  wrote:
>
>
> On Sep 5, 2016, at 10:13 AM, Darin Adler  wrote:
>
> Hi folks.
>
> WebKit has some critical functions that involve asking an object to give
> up ownership of something so the caller can take ownership.
>
> In the C++ standard library itself, this is called move, as in std::move.
>
> In WebKit smart pointers, we call this operation release, as in
> RefPtr::releaseNonNull and String::releaseImpl.
>
> In WebKit collections, we call this operation take, as in HashMap::take
> and ExceptionOr::takeReturnValue.
>
> The release vs. take terminology is distracting to my eyes. The verb
> “take" states what the caller wishes to do, and the verb “release” states
> what the caller wants the collection or smart pointer to do.
>
>
> This can be addressed by renaming take to give (hey, it’s right there in
> the subject).
>
>
> It's logical but reads perhaps a little strangely:
>
> Value& = map.give(key)
> X* = x_ref.give()
>
>  - Maciej
>
>
> 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.
>
> 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?
>
>
> Rename release to give, too?
> ___
> webkit-dev mailing list
> webkit-dev@lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev
>
>
>
> ___
> webkit-dev mailing list
> webkit-dev@lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev
>
>
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Terminology for giving up ownership: take, release, move

2016-09-05 Thread Maciej Stachowiak

> On Sep 5, 2016, at 3:30 PM, Dan Bernstein  wrote:
> 
>> 
>> On Sep 5, 2016, at 10:13 AM, Darin Adler  wrote:
>> 
>> Hi folks.
>> 
>> WebKit has some critical functions that involve asking an object to give up 
>> ownership of something so the caller can take ownership.
>> 
>> In the C++ standard library itself, this is called move, as in std::move.
>> 
>> In WebKit smart pointers, we call this operation release, as in 
>> RefPtr::releaseNonNull and String::releaseImpl.
>> 
>> In WebKit collections, we call this operation take, as in HashMap::take and 
>> ExceptionOr::takeReturnValue.
>> 
>> The release vs. take terminology is distracting to my eyes. The verb “take" 
>> states what the caller wishes to do, and the verb “release” states what the 
>> caller wants the collection or smart pointer to do.
> 
> This can be addressed by renaming take to give (hey, it’s right there in the 
> subject).

It's logical but reads perhaps a little strangely:

Value& = map.give(key)
X* = x_ref.give()

 - Maciej

> 
>> 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.
>> 
>> 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?
> 
> Rename release to give, too?
> ___
> webkit-dev mailing list
> webkit-dev@lists.webkit.org 
> https://lists.webkit.org/mailman/listinfo/webkit-dev 
> 
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Terminology for giving up ownership: take, release, move

2016-09-05 Thread Dan Bernstein

> On Sep 5, 2016, at 10:13 AM, Darin Adler  wrote:
> 
> Hi folks.
> 
> WebKit has some critical functions that involve asking an object to give up 
> ownership of something so the caller can take ownership.
> 
> In the C++ standard library itself, this is called move, as in std::move.
> 
> In WebKit smart pointers, we call this operation release, as in 
> RefPtr::releaseNonNull and String::releaseImpl.
> 
> In WebKit collections, we call this operation take, as in HashMap::take and 
> ExceptionOr::takeReturnValue.
> 
> The release vs. take terminology is distracting to my eyes. The verb “take" 
> states what the caller wishes to do, and the verb “release” states what the 
> caller wants the collection or smart pointer to do.

This can be addressed by renaming take to give (hey, it’s right there in the 
subject).

> 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.
> 
> 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?

Rename release to give, too?
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Terminology for giving up ownership: take, release, move

2016-09-05 Thread Maciej Stachowiak

> On Sep 5, 2016, at 3:18 PM, Ryosuke Niwa  wrote:
> 
> On Mon, Sep 5, 2016 at 2:48 PM, Ryosuke Niwa  > wrote:
>> On Mon, Sep 5, 2016 at 2:47 PM, Filip Pizlo  wrote:
>>> 
>>> On Sep 5, 2016, at 2:35 PM, Ryosuke Niwa  wrote:
>>> 
>>> On Mon, Sep 5, 2016 at 10:13 AM, Darin Adler  wrote:
>>> 
>>> Hi folks.
>>> 
>>> WebKit has some critical functions that involve asking an object to give up
>>> ownership of something so the caller can take ownership.
>>> 
>>> In the C++ standard library itself, this is called move, as in std::move.
>>> 
>>> In WebKit smart pointers, we call this operation release, as in
>>> RefPtr::releaseNonNull and String::releaseImpl.
>>> 
>>> In WebKit collections, we call this operation take, as in HashMap::take and
>>> ExceptionOr::takeReturnValue.
>>> 
>>> The release vs. take terminology is distracting to my eyes. The verb “take"
>>> 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.
>>> 
>>> 
>>> I agree the verb "take" is not semantically sound here.  How about
>>> HashMap::receiveReleased / ExceptionOr::receiveReleased?  Or simply
>>> HashMap::released / ExceptionOr::takeReleased?  Even HashMap::receive
>>> / ExceptionOr::receiveReturnValue might work better because "receive"
>>> is more a passive form of accepting the ownership of something.
>>> 
>>> 
>>> I don't think that HashMap::receiveReleased() fits with
>>> Subject::verbPhrase().  In HashMap::take(), the HashMap is releasing
>>> ownership of a value.  So, it is releasing it.  It's definitely not
>>> receiving it.
>> 
>> Oh I see.  Sorry, I had assumed they were just taking Ref<>&& as an
>> argument.  In that case, release() definitely seems like the right
>> terminology to use.
> 
> Hm... now that I recall the semantics of HashMap::take, I've started
> to think that "release()" on its own may not be the right name for
> collections because these member functions remove an item from a
> collection while releasing the ownership.  Maybe "removeAndRelease()"
> or "removeToRelease()" would do.
> 
> Alternatively, we could make the regular "remove()" always return the
> removed value (or maybe this would result in more code bloat / runtime
> cost?)

Current HashMap::remove returns a boolean which indicates wether the item was 
found. It also avoids doing a move to a temporary. So both efficiency and 
compatibility may be relevant considerations. If you consider the option of 
renaming the basic remove as well as the one that returns a value, you could 
use erase() for the one that doesn't return the value and remove() for the one 
that does.





___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Terminology for giving up ownership: take, release, move

2016-09-05 Thread Ryosuke Niwa
On Mon, Sep 5, 2016 at 2:48 PM, Ryosuke Niwa  wrote:
> On Mon, Sep 5, 2016 at 2:47 PM, Filip Pizlo  wrote:
>>
>> On Sep 5, 2016, at 2:35 PM, Ryosuke Niwa  wrote:
>>
>> On Mon, Sep 5, 2016 at 10:13 AM, Darin Adler  wrote:
>>
>> Hi folks.
>>
>> WebKit has some critical functions that involve asking an object to give up
>> ownership of something so the caller can take ownership.
>>
>> In the C++ standard library itself, this is called move, as in std::move.
>>
>> In WebKit smart pointers, we call this operation release, as in
>> RefPtr::releaseNonNull and String::releaseImpl.
>>
>> In WebKit collections, we call this operation take, as in HashMap::take and
>> ExceptionOr::takeReturnValue.
>>
>> The release vs. take terminology is distracting to my eyes. The verb “take"
>> 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.
>>
>>
>> I agree the verb "take" is not semantically sound here.  How about
>> HashMap::receiveReleased / ExceptionOr::receiveReleased?  Or simply
>> HashMap::released / ExceptionOr::takeReleased?  Even HashMap::receive
>> / ExceptionOr::receiveReturnValue might work better because "receive"
>> is more a passive form of accepting the ownership of something.
>>
>>
>> I don't think that HashMap::receiveReleased() fits with
>> Subject::verbPhrase().  In HashMap::take(), the HashMap is releasing
>> ownership of a value.  So, it is releasing it.  It's definitely not
>> receiving it.
>
> Oh I see.  Sorry, I had assumed they were just taking Ref<>&& as an
> argument.  In that case, release() definitely seems like the right
> terminology to use.

Hm... now that I recall the semantics of HashMap::take, I've started
to think that "release()" on its own may not be the right name for
collections because these member functions remove an item from a
collection while releasing the ownership.  Maybe "removeAndRelease()"
or "removeToRelease()" would do.

Alternatively, we could make the regular "remove()" always return the
removed value (or maybe this would result in more code bloat / runtime
cost?)

- R. Niwa
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Terminology for giving up ownership: take, release, move

2016-09-05 Thread Maciej Stachowiak

> On Sep 5, 2016, at 2:35 PM, Ryosuke Niwa  wrote:
> 
> On Mon, Sep 5, 2016 at 10:13 AM, Darin Adler  > wrote:
>> Hi folks.
>> 
>> WebKit has some critical functions that involve asking an object to give up 
>> ownership of something so the caller can take ownership.
>> 
>> In the C++ standard library itself, this is called move, as in std::move.
>> 
>> In WebKit smart pointers, we call this operation release, as in 
>> RefPtr::releaseNonNull and String::releaseImpl.
>> 
>> In WebKit collections, we call this operation take, as in HashMap::take and 
>> ExceptionOr::takeReturnValue.
>> 
>> The release vs. take terminology is distracting to my eyes. The verb “take" 
>> 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.
> 
> I agree the verb "take" is not semantically sound here.  How about
> HashMap::receiveReleased / ExceptionOr::receiveReleased?  Or simply
> HashMap::released / ExceptionOr::takeReleased?  Even HashMap::receive
> / ExceptionOr::receiveReturnValue might work better because "receive"
> is more a passive form of accepting the ownership of something.

receive() is still caller-perspective so it doesn't solve the issue with 
take(). If you wanted a detailed and wordy name, getAndRemove() would be 
accurate and callee-perspective (though natural for collections but not so much 
for smart pointers). getAndRelease() would make sense for smart pointers, but 
not really for collections, since you normally ask collections to remove (or 
delete or erase), but to release.

release() as shorthand for getAnd{Remove,Release}() seems ok, though it would 
be local jargon and I'm not sure it would be very readable in the case of a 
HashMap, to those who are not familiar with it. Without knowing the jargon, it 
would not be apparent that this line of code does a lookup and removes the 
item: value = map.release(key)

Regards,
Maciej

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Terminology for giving up ownership: take, release, move

2016-09-05 Thread Maciej Stachowiak

> On Sep 5, 2016, at 10:13 AM, Darin Adler  wrote:
> 
> Hi folks.
> 
> WebKit has some critical functions that involve asking an object to give up 
> ownership of something so the caller can take ownership.
> 
> In the C++ standard library itself, this is called move, as in std::move.
> 
> In WebKit smart pointers, we call this operation release, as in 
> RefPtr::releaseNonNull and String::releaseImpl.
> 
> In WebKit collections, we call this operation take, as in HashMap::take and 
> ExceptionOr::takeReturnValue.
> 
> The release vs. take terminology is distracting to my eyes. The verb “take" 
> 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.
> 
> 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?

In the context of a container, take() sort of makes sense by parallel to get(). 
Though get() could be interpreted as either what the caller is doing or what 
the callee is doing.

In other words, you could say that in the code below, function something gets 
an item from the collection. In that sense, take() is a parallel construct. Of 
course, you could instead say that function something asks collection to get an 
item. That's what makes take() not make sense. But I am not sure release() 
makes sense either way, for a collection. It conveys letting go of the item but 
doesn't seem to convey fetching in the sake way get() or take() do. I don't 
think move() would be right in this context either.

function something(Collection& collection, Key& key)
{
doSomething(collection.get(key))
}


Given that explanation, I think a possible direction is to rename the smart 
pointer release() operation to take(). Many of our smart pointers already have 
a get(). And the idea of taking the underlying value from a smart pointer kind 
of makes sense, even though it is caller-perspective.

Regards,
Maciej
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Terminology for giving up ownership: take, release, move

2016-09-05 Thread Ryosuke Niwa
On Mon, Sep 5, 2016 at 2:47 PM, Filip Pizlo  wrote:
>
> On Sep 5, 2016, at 2:35 PM, Ryosuke Niwa  wrote:
>
> On Mon, Sep 5, 2016 at 10:13 AM, Darin Adler  wrote:
>
> Hi folks.
>
> WebKit has some critical functions that involve asking an object to give up
> ownership of something so the caller can take ownership.
>
> In the C++ standard library itself, this is called move, as in std::move.
>
> In WebKit smart pointers, we call this operation release, as in
> RefPtr::releaseNonNull and String::releaseImpl.
>
> In WebKit collections, we call this operation take, as in HashMap::take and
> ExceptionOr::takeReturnValue.
>
> The release vs. take terminology is distracting to my eyes. The verb “take"
> 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.
>
>
> I agree the verb "take" is not semantically sound here.  How about
> HashMap::receiveReleased / ExceptionOr::receiveReleased?  Or simply
> HashMap::released / ExceptionOr::takeReleased?  Even HashMap::receive
> / ExceptionOr::receiveReturnValue might work better because "receive"
> is more a passive form of accepting the ownership of something.
>
>
> I don't think that HashMap::receiveReleased() fits with
> Subject::verbPhrase().  In HashMap::take(), the HashMap is releasing
> ownership of a value.  So, it is releasing it.  It's definitely not
> receiving it.

Oh I see.  Sorry, I had assumed they were just taking Ref<>&& as an
argument.  In that case, release() definitely seems like the right
terminology to use.

- R. Niwa
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Terminology for giving up ownership: take, release, move

2016-09-05 Thread Filip Pizlo

> On Sep 5, 2016, at 2:35 PM, Ryosuke Niwa  wrote:
> 
> On Mon, Sep 5, 2016 at 10:13 AM, Darin Adler  > wrote:
>> Hi folks.
>> 
>> WebKit has some critical functions that involve asking an object to give up 
>> ownership of something so the caller can take ownership.
>> 
>> In the C++ standard library itself, this is called move, as in std::move.
>> 
>> In WebKit smart pointers, we call this operation release, as in 
>> RefPtr::releaseNonNull and String::releaseImpl.
>> 
>> In WebKit collections, we call this operation take, as in HashMap::take and 
>> ExceptionOr::takeReturnValue.
>> 
>> The release vs. take terminology is distracting to my eyes. The verb “take" 
>> 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.
> 
> I agree the verb "take" is not semantically sound here.  How about
> HashMap::receiveReleased / ExceptionOr::receiveReleased?  Or simply
> HashMap::released / ExceptionOr::takeReleased?  Even HashMap::receive
> / ExceptionOr::receiveReturnValue might work better because "receive"
> is more a passive form of accepting the ownership of something.

I don't think that HashMap::receiveReleased() fits with Subject::verbPhrase().  
In HashMap::take(), the HashMap is releasing ownership of a value.  So, it is 
releasing it.  It's definitely not receiving it.

-Filip

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Terminology for giving up ownership: take, release, move

2016-09-05 Thread Ryosuke Niwa
On Mon, Sep 5, 2016 at 10:13 AM, Darin Adler  wrote:
> Hi folks.
>
> WebKit has some critical functions that involve asking an object to give up 
> ownership of something so the caller can take ownership.
>
> In the C++ standard library itself, this is called move, as in std::move.
>
> In WebKit smart pointers, we call this operation release, as in 
> RefPtr::releaseNonNull and String::releaseImpl.
>
> In WebKit collections, we call this operation take, as in HashMap::take and 
> ExceptionOr::takeReturnValue.
>
> The release vs. take terminology is distracting to my eyes. The verb “take" 
> 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.

I agree the verb "take" is not semantically sound here.  How about
HashMap::receiveReleased / ExceptionOr::receiveReleased?  Or simply
HashMap::released / ExceptionOr::takeReleased?  Even HashMap::receive
/ ExceptionOr::receiveReturnValue might work better because "receive"
is more a passive form of accepting the ownership of something.

- R. Niwa
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Terminology for giving up ownership: take, release, move

2016-09-05 Thread Filip Pizlo

> On Sep 5, 2016, at 10:13 AM, Darin Adler  wrote:
> 
> Hi folks.
> 
> WebKit has some critical functions that involve asking an object to give up 
> ownership of something so the caller can take ownership.
> 
> In the C++ standard library itself, this is called move, as in std::move.
> 
> In WebKit smart pointers, we call this operation release, as in 
> RefPtr::releaseNonNull and String::releaseImpl.
> 
> In WebKit collections, we call this operation take, as in HashMap::take and 
> ExceptionOr::takeReturnValue.
> 
> The release vs. take terminology is distracting to my eyes. The verb “take" 
> 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.
> 
> 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?

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 wouldn't want any words other than "release" used for this purpose, because I 
know exactly what to expect "release" to mean, since we use it so much already. 
 I think that would be even worse than sometimes using "take", because even 
though "takeReturnValue" is annoying, I've learned to know what it means.

If there isn't anyone who prefers take, maybe we should just rename "take" to 
"release" in these cases?

-Filip


> 
> — Darin
> ___
> webkit-dev mailing list
> webkit-dev@lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


[webkit-dev] Terminology for giving up ownership: take, release, move

2016-09-05 Thread Darin Adler
Hi folks.

WebKit has some critical functions that involve asking an object to give up 
ownership of something so the caller can take ownership.

In the C++ standard library itself, this is called move, as in std::move.

In WebKit smart pointers, we call this operation release, as in 
RefPtr::releaseNonNull and String::releaseImpl.

In WebKit collections, we call this operation take, as in HashMap::take and 
ExceptionOr::takeReturnValue.

The release vs. take terminology is distracting to my eyes. The verb “take" 
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.

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?

— Darin
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev