On Nov 11, 2009, at 6:56 PM, Chris Jerdonek wrote:
> What is the current thinking on all of the "using WTF::..." statements at the
> end of many header files in JSC? For example, what was the original reason
> behind including those, and is there any chance that they will be taken out
> at a later date (or has that already been ruled out)? I searched a bit and
> didn't come across any discussion of this.
WTF uses namespacing differently than most libraries. We’re using it to
disambiguate at link time, but not compile time.Having the symbols in a
namespace at link time still has a substantial benefit, so it’s good to put
things in a WTF namespace instead of just putting them outside any namespace.
Maciej Stachowiak devised this scheme for WTF, and I think on balance it’s
probably a good way to do things although I would probably not have chosen it
myself, and would have used the more conventional scheme. Maciej and I and a
few others at Apple discussed this a bit a few years back, but nobody on any
WebKit mailing list ever raised the issue before.
Since WTF is for use inside WebKit itself, I think we can stick with this
approach unless we run into a substantial, concrete problem with it.
I don’t think things would be better if we did this in the conventional way and
either had to utter WTF::RefPtr and WTF::Vector in WebCore and JavaScriptCore
header files, or every client of RefPtr had to include a certain header file
with a "using WTF::RefPtr" in the WebCore or JavaScriptCore namespace.
Similarly if many .cpp files had to have "using namespace WTF".
For a while I was adding "using namespace WTF" to .cpp files because I did not
understand our WTF namespacing approach.
-- Darin
_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev