__FUNCTION__ implemented with mixins and mangles

zsxxsz zhengshuxin at hexun.com
Sun Jun 14 18:37:53 PDT 2009


== Quote from Jarrett Billingsley (jarrett.billingsley at gmail.com)'s article
> On Sat, Jun 13, 2009 at 9:46 PM, zsxxsz<zhengshuxin at 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.



More information about the Digitalmars-d mailing list