On Oct 12, 2010, at 10:12 PM, Darin Fisher wrote:
> Caused more harm than good?
I think it was a good decision.
I don’t have a lot of patience for these abstract debates — I would much prefer
to talk about a specific example rather than these vague principles — but here
are some of my thoughts.
The weak pointer pattern is still alive and well in WebKit on an ad hoc basis.
Over these first nine or so years of the project we have had many more problems
with null pointer dereferences than with storage leaks due to reference cycles.
Code following weak pointers such as the pointer from a frame to its page often
incorrectly assumes the pointer value is non-zero.
I empathize with your Mozilla experiences with reference cycles, and I think
there are places where it’s a good pattern to use a weak pointer. A
general-purpose weak pointer template is expensive enough that I don’t think
it’s a good thing for us to add.
I think of reference counting as a way to make pointer lifetimes work, but for
many objects there’s a separate object lifetime that’s better to manage
directly. I can think of three or four times in the last year where we fixed a
thorny problem by adding reference counting to a class that started out as
single-owner and I think the track record has been good for this in the project
so far.
-- Darin
_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev