__FUNCTION__ implemented with mixins and mangles

Nick Sabalausky a at a.a
Sun Jun 14 21:34:01 PDT 2009


"Ary Borenszweig" <ary at esperanto.org.ar> wrote in message 
news:h149vq$21ku$1 at digitalmars.com...
> zsxxsz escribió:
>> == 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.
>
> 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.

Great, now try to take that language with great debugging support, and use 
it to do the same wonderful debugging on a *platform* that doesn't have 
excellent debugging support. Not everyone writes desktop apps. Besides, 
there's been plenty of times I've solved a problem using __blah__ and printf 
debugging in less time than it would have taken to fire up the debugger. And 
as for __FUNCTION__, that's useful for DRY.





More information about the Digitalmars-d mailing list