2012/7/19 Brady Eidson <beid...@apple.com>: > > On Jul 19, 2012, at 10:53 AM, Andreas Kling <kl...@webkit.org> wrote: > > On Tue, Jul 10, 2012 at 4:52 PM, Brady Eidson <beid...@apple.com> wrote: >> >> >> On Jul 10, 2012, at 5:25 AM, Alexis Menard <alexis.men...@openbossa.org> >> wrote: >> >> > On Mon, Jul 9, 2012 at 6:53 PM, Brady Eidson <beid...@apple.com> wrote: >> >> >> >> On Jul 9, 2012, at 2:43 PM, Alexis Menard <alexis.men...@openbossa.org> >> >> wrote: >> >> >> >>> Hi, >> >>> >> >>> For those who "secretly" use printf debugging :). I know the >> >>> recommended way is to use a debugger and it's not the point of this >> >>> discussion. >> >> >> >> A lot of us do this, and sometimes it's necessary. I agree with the >> >> gripe and support adding something easier. >> >> >> >>> So I propose wtf() and its stream operator. >> >>> >> >>> Usage : >> >>> >> >>> wtf()<<"Hello"<<"World"<<3<<4.53322323; will output : Hello World 3 >> >>> 4.53322 >> >> >> >> There is no reason to bring in stream operators - that are willfully >> >> absent from WebCore - just for debugging. >> >> >> > >> > But it's really nice for that purpose, and somehow match std::cout >> >> And we quite purposefully don't use std::cout in the project. >> >> >> Overloading functions works just as well. >> > >> > I'm not sure to understand what you mean hereā¦ >> >> I mean relying on C++'s overloading of functions for the different types >> you'd like to printf debug. >> >> void debug(WebCore::String&); >> void debug(WebCore::Frame*); >> void debug(WebCore::Node*); >> >> etc etc etc. >> >> debug(someFrame); >> debug(someNode); >> debug(someString); >> >> Especially that last one would help me from remembering how to type >> "printf("%s", someString.utf8().data())" which is all I've ever really >> wanted. > > > Hello fellow printfers! > > While I'm just as ashamed of my printf habits as the next guy, I think it'd > be great if we could move forward with this somehow. > > Coming from a background in Qt, the stream operator syntax looks perfectly > normal to me, perhaps you could expand on why we want to avoid using these > in WebKit. Is there a technical reason, or is it more of a language purity > issue? > > > A possible technical reason - that I am 100% theorizing about - is that it > might bring in more libraries at link time or runtime since it would be the > absolute first use of stream operators in the project. > > That possibility aside, the stronger part of my objection is language > purity. WebCore uses C++ as "C with classes" and I don't think it's worth > it to confuse new (or existing) contributors about that going forward. >
Can you elaborate why WebCore uses C++ as "C with classes"? We are using namespace, template, operator overloading, virtual functions, multi-inheritance, scope object, and even pointer-to-member. We prefer Vector<> to C array, and prefer OwnPtr/RefPtr to C pointer. Where is C stuff? > Regardless, adding a consistent set of debug(WebCore::MyCoolOverload) > methods as suggested would still be massively useful. > > > Definitely. > > ~Brady > > > -Kling > > > > _______________________________________________ > webkit-dev mailing list > webkit-dev@lists.webkit.org > http://lists.webkit.org/mailman/listinfo/webkit-dev > _______________________________________________ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo/webkit-dev