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

David Levin levin at google.com
Tue Sep 28 16:26:08 PDT 2010


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.

dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20100928/d83bf58f/attachment.html>


More information about the webkit-dev mailing list