__FUNCTION__

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Feb 28 12:39:41 PST 2009


Nick Sabalausky wrote:
> "dsimcha" <dsimcha at yahoo.com> wrote in message 
> news:goc1k7$qml$1 at digitalmars.com...
>> == Quote from Jarrett Billingsley (jarrett.billingsley at gmail.com)'s 
>> article
>>> Can we get this please?  It's so simple and would be terribly useful.
>> Can someone explain what __FUNCTION__ would do in a little more detail?  I 
>> feel
>> like the two posts of this thread so far are talking in secret 
>> __FUNCTION__-dealer
>> code.
> 
> void foofunc()
> {
>     Stdout.formatln("{}", __FUNCTION__);
> }
> 
> Output:
> foofunc
> 
> Ie, basically the same as __FILE__ and __LINE__ and useful in the same ways.

I think instead of __FUNCTION__ we'll define a much more comprehensive 
static reflection facility.

> Also, I'd like to be able to do something like:
> 
> Reflect.invoke(__FUNCTION__, params);

Yah... and Variant needs to have something similar as well. We know 
quite what std.reflect needs to look like, just we want to keep our 
fingers out of too many pies at once.

> Something funtionally equiveilent to that would aid maitenance of 
> self-invoking functions (not only recusion, but also func overloads that are 
> defined in terms of one "primary" overload).
> 
> Also would be nice for similar reasons: __CLASS__ (or something similar that 
> would also work for structs) 

Yah.

Andrei



More information about the Digitalmars-d mailing list