On Apr 29, 2013, at 10:33 AM, Anders Carlsson <ander...@apple.com> wrote:

> 
> On Apr 28, 2013, at 1:00 PM, Geoffrey Garen <gga...@apple.com> wrote:
> 
>> Hi Mikhail.
>> 
>>> In continuation of the topic I'd like also to know people's opinion about 
>>> Pass*Ptr types deprecation:
>> 
>> I don't think this is appropriate until the compilers on all our major 
>> target platforms support C++11. I believe Windows is currently the primary 
>> barrier.
>> 
>> Once we have C++11 on all our major target platforms, I think it would great 
>> to adopt C++11 idioms throughout the project. 
>> 
>> I believe that part of our reasoning for deploying C++11 idioms in WebKit2 
>> is that it meets this criterion.
> 
> I agree.
> 
> In WebKit2 we have much more freedom to do C++11 experimentation, both due to 
> not having to think about Windows but also due to the fact that WebKit2 is 
> about one fifth the size of WebCore when it comes to number of lines of code.
> 
> When we come up with successful C++11 design patterns and idioms in WebKit2, 
> we can apply them to WebCore when the time is ready. (One thing I’m playing 
> with in WebKit2 is to stop using PassOwnPtr and just using std::move instead).

I feel like consumeValue(std::move(localTemporary)) is less understandable than 
consumeValue(localTemporary.release()). But I guess that's just surface syntax. 
Here's a few things I am interested in about the effects effect of this.

I think a lot of the helpfulness of the Pass* types is in the following 
scenarios:

== Scenario A ==

PassOwnPtr<T> valueProducer() { ... }
void valueConsumer(const PassOwnPtr<T>&) { ... }

void someOtherFunc()
{
    valueConsumer(valueProducer());
}

-- Is this still doable with std::move / rvalues? If so what does it look like?
-- Will it be possible to have typechecking fail if you try to give 
valueConsumer a regular smart pointer instead of a "movable" one?


== Scenario B ==

PassOwnPtr<T> valueProducer() { ... }
void valueConsumer(const PassOwnPtr<T>&) { ... }

void someOtherFunc()
{
    OwnPtr<T> temporaryLocal = valueProducer();
    temporaryLocal->someSideEffect();
    valueConsumer(temporaryLocal.release());
}

-- Is this still doable with std::move / rvalues? If so what does it look like?
-- Will it be possible to have typechecking fail if you try to give 
valueConsumer a regular smart pointer instead of a "movable" one, i.e. you 
forget the release/move?

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

Reply via email to