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

Oliver Hunt oliver at apple.com
Tue Sep 28 16:30:12 PDT 2010


On Sep 28, 2010, at 4:26 PM, David Levin 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:
> Use explicit only when necessary to prevent an undesirable implicit conversion like int to vector.
> 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.

Could check-webkit-style be beaten into forcing this for us?

> 
> Pro's for #2
>    It would prevent accidental mistakes that happen with implicit constructors.
> 
> dave
> 
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

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


More information about the webkit-dev mailing list