[webkit-dev] converting by constructor

Chris Jerdonek cjerdonek at webkit.org
Mon May 17 17:28:38 PDT 2010


On Mon, May 17, 2010 at 3:11 PM, Darin Adler <darin at apple.com> wrote:
> I think the best way for us to clarify our guideline for this would be to discuss a few individual cases where we have a non-explicit constructor. We can talk about why they are not explicit and see if we find they are just bugs or show a principle at work.


I wasn't intending to create a formal guideline, but one example I encountered
recently is ResourceRequest, which has String and KURL single-parameter
constructors without the explicit keyword.

The FrameLoader class has about 25 methods that accept a ResourceRequest
(e.g. various load methods), so all of these also accept a String and
KURL.  This makes it harder to know the right way these methods
should be getting called.  This also makes it harder to refactor.  Call
sites seem to use all three variations.  The class also has other load-like
methods that accept a String url, and others that accept a KURL url.

--Chris


More information about the webkit-dev mailing list