Re: [webkit-dev] Should we ever use std::function instead of WTF::Function?

2017-06-13 Thread Alex Christensen
std::function, c++ lambda, and objc blocks are all interchangeable. WTF::Functions cannot be used as objc blocks because the latter must be copyable. Until that changes or we stop using objc, we cannot completely eliminate std::function from WebKit.

Re: [webkit-dev] Should we ever use std::function instead of WTF::Function?

2017-06-13 Thread Alex Christensen
Ok, maybe we can get rid of std::function, then! I hadn’t used BlockPtr as much as Chris. I’d be opposed to adding a copy constructor to WTF::Function because the non-copyability of WTF::Function is why we made it, and it has prevented many bugs. I’ve also seen many cases where I have a

Re: [webkit-dev] Should we ever use std::function instead of WTF::Function?

2017-06-13 Thread Chris Dumez
> On Jun 13, 2017, at 12:51 PM, Filip Pizlo wrote: > >> >> On Jun 13, 2017, at 12:37 PM, Alex Christensen > > wrote: >> >> Ok, maybe we can get rid of std::function, then! I hadn’t used BlockPtr as >> much as Chris.

Re: [webkit-dev] Should we ever use std::function instead of WTF::Function?

2017-06-13 Thread Filip Pizlo
> On Jun 13, 2017, at 1:00 PM, Chris Dumez wrote: > > >> On Jun 13, 2017, at 12:51 PM, Filip Pizlo > > wrote: >> >>> >>> On Jun 13, 2017, at 12:37 PM, Alex Christensen >> >

Re: [webkit-dev] Should we ever use std::function instead of WTF::Function?

2017-06-13 Thread Filip Pizlo
> On Jun 13, 2017, at 12:37 PM, Alex Christensen wrote: > > Ok, maybe we can get rid of std::function, then! I hadn’t used BlockPtr as > much as Chris. I’d be opposed to adding a copy constructor to WTF::Function > because the non-copyability of WTF::Function is why

Re: [webkit-dev] Should we ever use std::function instead of WTF::Function?

2017-06-13 Thread Filip Pizlo
> On Jun 13, 2017, at 11:56 AM, Brady Eidson wrote: > >> >> On Jun 13, 2017, at 9:55 AM, Filip Pizlo > > wrote: >> >> Would SharedTask’s sharing be semantically incorrect for users of >> WTF::Function? In other words, do you

Re: [webkit-dev] Should we ever use std::function instead of WTF::Function?

2017-06-13 Thread Filip Pizlo
And ObjC blocks share instead of copying, which is more like SharedTask. I think that’s another reason why adding copy constructors to WTF::Function that do block-like sharing under the hood is rather attractive. -Filip > On Jun 13, 2017, at 12:29 PM, Alex Christensen

Re: [webkit-dev] Should we ever use std::function instead of WTF::Function?

2017-06-13 Thread Chris Dumez
We already have BlockPtr for passing a Function as a lambda block. Chris Dumez > On Jun 13, 2017, at 12:29 PM, Alex Christensen wrote: > > std::function, c++ lambda, and objc blocks are all interchangeable. > WTF::Functions cannot be used as objc blocks because the

Re: [webkit-dev] Should we ever use std::function instead of WTF::Function?

2017-06-13 Thread Brady Eidson
> On Jun 13, 2017, at 12:37 PM, Alex Christensen wrote: > > I’d be opposed to adding a copy constructor to WTF::Function because the > non-copyability of WTF::Function is why we made it, and it has prevented many > bugs. Ditto. The lack of a copy c’tor in

[webkit-dev] Bring back ARMv6 support to JSC

2017-06-13 Thread Caio Lima
Hi All. Some of you guys might know me through the work I have been doing in JSC. The experience working with WebKit has been great so far, thank you for the reviews! Since 1st May, we at Igalia have been working on bring back the ARMv6 support into JSC. We already have commits into our

Re: [webkit-dev] Should we ever use std::function instead of WTF::Function?

2017-06-13 Thread Chris Dumez
The only advantage of std::function that I know of is that it is copyable. Unless you really need to copy your lambda for a reason or another, I don’t see a good reason to ever use std::function instead of WTF::Function. I have been slowly replacing std::function by WTF::Function in the code

Re: [webkit-dev] Should we ever use std::function instead of WTF::Function?

2017-06-13 Thread Filip Pizlo
I like these renamings. I’m also ok with renaming Function to UniqueFunction but I’m also ok with keeping the current name. -Filip > On Jun 13, 2017, at 10:12 AM, Konstantin Tokarev wrote: > > > > 13.06.2017, 20:08, "Maciej Stachowiak" : >> In case it

[webkit-dev] Should we ever use std::function instead of WTF::Function?

2017-06-13 Thread Darin Adler
I’ve noticed many patches switching us from std::function to WTF::Function recently, to fix problems with copying and thread safety. Does std::function have any advantages over WTF::Function? Should we ever prefer std::function, or should we use WTF::Function everywhere in WebKit where we

Re: [webkit-dev] Should we ever use std::function instead of WTF::Function?

2017-06-13 Thread Chris Dumez
In most cases in WebCore at least, we don’t actually want to share ownership of the lambda so we don’t need RefCounting / SharedTask. Because of this, I don’t think we should merge SharedTask into Function. I think that as it stands, WTF::Function is a suitable replacement for most uses in

Re: [webkit-dev] Should we ever use std::function instead of WTF::Function?

2017-06-13 Thread Brady Eidson
> On Jun 13, 2017, at 9:55 AM, Filip Pizlo wrote: > > Would SharedTask’s sharing be semantically incorrect for users of > WTF::Function? In other words, do you rely on the compiler error that says > that there is no copy constructor? WTF::Function is used in cross-thread

Re: [webkit-dev] Should we ever use std::function instead of WTF::Function?

2017-06-13 Thread Filip Pizlo
We should have a better story here. Right now the story is too complicated. We have: - ScopedLambda or ScopedLambdaRef if you have a stack-allocated function that outlives its user - SharedTask if you have a heap-allocated function that you want to share and ref-count - WTF::Function if you

Re: [webkit-dev] Should we ever use std::function instead of WTF::Function?

2017-06-13 Thread Filip Pizlo
Would SharedTask’s sharing be semantically incorrect for users of WTF::Function? In other words, do you rely on the compiler error that says that there is no copy constructor? I’m imagining that if WTF::Function was backed by SharedTask that it would not result in any behavior change for

Re: [webkit-dev] Should we ever use std::function instead of WTF::Function?

2017-06-13 Thread Maciej Stachowiak
In case it turns out not to be possible to reduce the number of concepts (besides eliminating std::function), maybe it would help to change the names and behaviors of these classes to match better. Function, SharedFunction and ScopedFunction would have a much more obvious relationship to each

Re: [webkit-dev] Should we ever use std::function instead of WTF::Function?

2017-06-13 Thread Konstantin Tokarev
13.06.2017, 20:08, "Maciej Stachowiak" : > In case it turns out not to be possible to reduce the number of concepts > (besides eliminating std::function), maybe it would help to change the names > and behaviors of these classes to match better. Function, SharedFunction and >