__FUNCTION__ implemented with mixins and mangles

Jarrett Billingsley jarrett.billingsley at gmail.com
Sun Jun 14 07:29:31 PDT 2009


On Sun, Jun 14, 2009 at 9:31 AM, Denis Koroskin<2korden at gmail.com> wrote:
> On Sun, 14 Jun 2009 17:29:21 +0400, grauzone <none at example.net> wrote:
>
>> Jarrett Billingsley wrote:
>>>
>>> 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
>>>> like
>>>> __FILE__  and __LINE__. __FUNCTION__ should be the base D language
>>>> syntax same as
>>>> __FILE__, __LINE__, in C99, they're all the compiler's things to get
>>>> these 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
>>
>> All we need is a __HERE__, which expands into a struct literal that
>> provides module, filename, etc. fields. It even can be linked to the next
>> enclosing scope to walk upwards nested functions and types.
>>
>> __FILE__ becomes __HERE__.filename,
>> __LINE__ becomes __HERE__.line
>>
>
> IIRC, it was previously proposed it as __SCOPE__

Oh, but I want it to be called __LOCATION__!  No, __CONTEXT__!  :P

I really don't care WHAT it's called or what its semantics are.  This
is a simple problem.  This should not be hard to solve.  Bah.



More information about the Digitalmars-d mailing list