Ary Borenszweig wrote:
zsxxsz escribió:
== Quote from Jarrett Billingsley (jarrett.billings...@gmail.com)'s article
On Sat, Jun 13, 2009 at 9:46 PM, zsxxsz<zhengshu...@hexun.com> wrote:
It's good. But I think it should be implement by the DMD compiler, just l
ike
__FILE__  and __LINE__. __FUNCTION__ should be the base D language synt
ax same as
__FILE__, __LINE__, in C99, they're all the compiler's things to get thes
e and the
compiler do these more easily than any library.

I completely agree, but Walter and Andrei's argument against it is -
where does it end?  Do we need __PACKAGE__, __MODULE__, __TYPE__,
__TEMPLATE__, etc. etc. etc.?  And I agree with them too - but you
know, it'd be nice to actually get some results on these things once
in a while instead of a bunch of bullshit bikeshed discussions.
Sheesh.

What is the main use of __FILE__, __LINE__ and __FUNCTION__? Many people just use them for logging easily, including me. In some famous server such as Postfix, you may see 'const char *myname = "xxx"; ... msg_info("%s: xxx", myname);' in many files, it's a time cost for the programmer to do so. These are base requirments
for D compiler.

I never had to use them in other languages. Why? Because debugging support in them is excelent. So maybe enhancing debugging support for D is better than adding a couple of keywords just to make *printf debugging* better.

__FILE__, __LINE__, __FUNCTION__, etc. are more often used for *logging* than for debugging. Of course, ideally, the logger would be able to identify all this stuff on its own (i.e. from a stack trace), but in a compiled language this is pretty tricky (impossible on Windows without debug symbols).

Reply via email to