RESOLVED FIXED 158596
Introduce WTF::UniqueRef
https://bugs.webkit.org/show_bug.cgi?id=158596
Summary Introduce WTF::UniqueRef
Alex Christensen
Reported 2016-06-09 18:51:51 PDT
Introduce WTF::Unique
Attachments
Patch (24.84 KB, patch)
2016-06-09 19:10 PDT, Alex Christensen
no flags
Patch (24.96 KB, patch)
2016-06-09 19:16 PDT, Alex Christensen
no flags
Patch (25.13 KB, patch)
2016-06-09 20:20 PDT, Alex Christensen
no flags
Patch (25.46 KB, patch)
2016-06-09 22:09 PDT, Alex Christensen
no flags
Patch (27.02 KB, patch)
2016-06-09 22:21 PDT, Alex Christensen
no flags
Patch (27.06 KB, patch)
2016-06-09 23:26 PDT, Alex Christensen
no flags
Patch (27.45 KB, patch)
2016-06-09 23:55 PDT, Alex Christensen
beidson: review+
Alex Christensen
Comment 1 2016-06-09 19:10:28 PDT
Alex Christensen
Comment 2 2016-06-09 19:16:21 PDT
Alex Christensen
Comment 3 2016-06-09 20:20:34 PDT
Darin Adler
Comment 4 2016-06-09 20:21:22 PDT
I like the idea of this class, but I’m not sure I’m comfortable with the name Unique.
Darin Adler
Comment 5 2016-06-09 20:21:41 PDT
Maybe UniqueRef by analogy with unique_ptr.
Alex Christensen
Comment 6 2016-06-09 22:09:09 PDT
Alex Christensen
Comment 7 2016-06-09 22:21:56 PDT
Alex Christensen
Comment 8 2016-06-09 23:26:05 PDT
Alex Christensen
Comment 9 2016-06-09 23:55:43 PDT
Michael Catanzaro
Comment 10 2016-06-10 05:36:18 PDT
Comment on attachment 280999 [details] Patch I see the point: you have to use something like std::unique_ptr here, and having a type to indicate it can never be null seems useful. I just wonder if the actual benefit would be worth the cost of having one more type of Ref to learn and understand. Probably; converting pointer member variables to refs elsewhere in the code has had big readability benefits. Shame there's no standard solution for this. Agreed with Darin that the name is not good, a "unique ref" sounds like something that shouldn't be refcounted. It's hard to name though... "NonintrusiveRef" is not great, but it's the best I can think of. "NonnullUniquePtr" is awkward but clear. Alternatively we could try to think of a name that indicates its purpose for holding values of polymorphic type.
Alex Christensen
Comment 11 2016-06-10 14:24:41 PDT
Note You need to log in before you can comment on or make changes to this bug.