[webkit-dev] Should we recommend explicit constructors as part of WebKit style?

Darin Fisher darin at chromium.org
Tue Sep 28 16:29:59 PDT 2010

On Tue, Sep 28, 2010 at 4:26 PM, David Levin <levin at google.com> wrote:

> This came up before:
> https://lists.webkit.org/pipermail/webkit-dev/2010-May/012873.html but I'd
> like to understand it a bit better.
> It feels there were two points of view:
>    1. Use explicit only when necessary to prevent an undesirable implicit
>    conversion like int to vector.
>    2. Use explicit except when it is desirable to allow an implicit
>    conversion that makes the code simpler. For example, the String <->
>    AtomicString makes the bindings generator code simpler since it doesn't need
>    to know which the underlying method takes.
> Are there any reasons beyond personal preference to select either of these?
> Starting list:
> Pro's for #1
>   It is a pain to remember to put explicit every time you have a
> constructor with one argument.
> Pro's for #2
>    It would prevent accidental mistakes that happen with implicit
> constructors.
We're there some recent mishaps with implicit constructors that motivate
this thread?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20100928/2a840d69/attachment.html>

More information about the webkit-dev mailing list