caller trouble

2012-07-14 Thread captaindet
i need a discreet handle on the calling/instantiating source file (module). using __FILE__, it is surprisingly easy for functions (via argument) and templated functions (via template parameter) but i cannot get it working for templated classes. how can i make them aware of the calling module?

Re: caller trouble

2012-07-14 Thread Jonathan M Davis
On Saturday, July 14, 2012 01:53:34 captaindet wrote: i need a discreet handle on the calling/instantiating source file (module). using __FILE__, it is surprisingly easy for functions (via argument) and templated functions (via template parameter) but i cannot get it working for templated

Re: caller trouble

2012-07-14 Thread captaindet
On 2012-07-14 02:12, Jonathan M Davis wrote: [..] I believe that __FILE__ and __LINE__ are treated specially with functions in order for them to be filled in at the call site rather than the declaration site. If it's not working with classes, then that probably means that whatever special logic

Re: caller trouble

2012-07-14 Thread Jonathan M Davis
On Saturday, July 14, 2012 13:30:03 captaindet wrote: IIRC, __FILE__ is a template itself It's not. It's a special symbol recognized by the compiler, and ends up in several places in the grammar. - Jonathan M Davis

Re: caller trouble

2012-07-14 Thread Timon Gehr
On 07/14/2012 08:53 AM, captaindet wrote: i need a discreet handle on the calling/instantiating source file (module). using __FILE__, it is surprisingly easy for functions (via argument) and templated functions (via template parameter) but i cannot get it working for templated classes. how can i

Re: caller trouble

2012-07-14 Thread captaindet
auto _fun = fun(); //_fun == main.d auto _tfun = tfun(); //_tfun == main.d auto _tclass = new tclass!(); //_tclass.from == other.d !!! //this works but i do not want to provide __FILE__ explicitly: auto _tclassx = new tclass!(__FILE__)(); //_tclass.from == main.d //and why do i get 2 different