Re: modulename

2012-09-05 Thread captaindet
On 2012-09-05 13:05, Jose Armando Garcia wrote: On Sep 5, 2012, at 10:56, captaindet <2k...@gmx.net> wrote: On 2012-09-04 15:36, Andrej Mitrovic wrote: 9/4/12, Ellery Newcomer wrote: On 09/04/2012 12:41 PM, Andrej Mitrovic wrote: __FILE__? It doesn't necessarily have the exact package hie

Re: modulename

2012-09-05 Thread Andrej Mitrovic
On 9/5/12, Jonathan M Davis wrote: > That would be _way_ harder to implement. Right, this would only work for templated functions, but maybe not worth adding then.

Re: modulename

2012-09-05 Thread Jonathan M Davis
On Wednesday, September 05, 2012 20:46:08 Andrej Mitrovic wrote: > On 9/5/12, Jonathan M Davis wrote: > > Regardless of whether it works, __FILE__ and __LINE__ should be used as > > template arguments with extreme caution, because you end up with a new > > instantiation for _every_ use (at least i

Re: modulename

2012-09-05 Thread Andrej Mitrovic
On 9/5/12, Jonathan M Davis wrote: > Regardless of whether it works, __FILE__ and __LINE__ should be used as > template arguments with extreme caution, because you end up with a new > instantiation for _every_ use (at least if you use both together). Honestly it would be much better if the file a

Re: modulename

2012-09-05 Thread Jonathan M Davis
On Wednesday, September 05, 2012 11:05:10 Jose Armando Garcia wrote: > It should work for templates too; std.log uses this extensively. Or at > least it used to work. Can you post the code sample where it doesn't > work? Regardless of whether it works, __FILE__ and __LINE__ should be used as temp

Re: modulename

2012-09-05 Thread Jose Armando Garcia
On Sep 5, 2012, at 10:56, captaindet <2k...@gmx.net> wrote: On 2012-09-04 15:36, Andrej Mitrovic wrote: 9/4/12, Ellery Newcomer wrote: On 09/04/2012 12:41 PM, Andrej Mitrovic wrote: __FILE__? It doesn't necessarily have the exact package hierarchy. We could really use __MODULE__ then.

Re: modulename

2012-09-05 Thread captaindet
On 2012-09-04 15:36, Andrej Mitrovic wrote: 9/4/12, Ellery Newcomer wrote: On 09/04/2012 12:41 PM, Andrej Mitrovic wrote: __FILE__? It doesn't necessarily have the exact package hierarchy. We could really use __MODULE__ then. I think it's been asked before but I didn't see any enhanceme

Re: modulename

2012-09-04 Thread José Armando García Sancio
On Tue, Sep 4, 2012 at 1:36 PM, Andrej Mitrovic wrote: > 9/4/12, Ellery Newcomer wrote: > > On 09/04/2012 12:41 PM, Andrej Mitrovic wrote: > >> __FILE__? > >> > > > > It doesn't necessarily have the exact package hierarchy. > > We could really use __MODULE__ then. I think it's been asked before

Re: modulename

2012-09-04 Thread José Armando García Sancio
On Tue, Sep 4, 2012 at 2:00 PM, Jonathan M Davis wrote: > On Tuesday, September 04, 2012 22:40:19 Andrej Mitrovic wrote: > > On 9/4/12, Jonathan M Davis wrote: > > > But it looks like we now have std.traits.moduleName, so presumably that > > > will do the trick. > > > > How will that do the trick

Re: modulename

2012-09-04 Thread Jonathan M Davis
On Tuesday, September 04, 2012 22:40:19 Andrej Mitrovic wrote: > On 9/4/12, Jonathan M Davis wrote: > > But it looks like we now have std.traits.moduleName, so presumably that > > will do the trick. > > How will that do the trick if you don't have the reference to the > invoking module? Clearly,

Re: modulename

2012-09-04 Thread Ellery Newcomer
e now have std.traits.moduleName, so presumably that will do the trick. - Jonathan M Davis moduleName needs a symbol

Re: modulename

2012-09-04 Thread Andrej Mitrovic
On 9/4/12, Jonathan M Davis wrote: > But it looks like we now have std.traits.moduleName, so presumably that will > do the trick. How will that do the trick if you don't have the reference to the invoking module?

Re: modulename

2012-09-04 Thread Jonathan M Davis
On Tuesday, September 04, 2012 21:41:24 Andrej Mitrovic wrote: > __FILE__? That'll mostly work, but it's perfectly possible to give a module a name which is completely different from the file name. But it looks like we now have std.traits.moduleName, so presumably that will do the trick. - Jon

Re: modulename

2012-09-04 Thread Andrej Mitrovic
9/4/12, Ellery Newcomer wrote: > On 09/04/2012 12:41 PM, Andrej Mitrovic wrote: >> __FILE__? >> > > It doesn't necessarily have the exact package hierarchy. We could really use __MODULE__ then. I think it's been asked before but I didn't see any enhancement request in buzilla.

Re: modulename

2012-09-04 Thread Ellery Newcomer
On 09/04/2012 12:41 PM, Andrej Mitrovic wrote: __FILE__? It doesn't necessarily have the exact package hierarchy. e.g: // wonka.d module willy.wonka; pragma(msg, __FILE__); // end wonka.d dmd wonka.d gives "wonka.d" but dmd willy/wonka.d gives "willy/wonka.d"

Re: modulename

2012-09-04 Thread Andrej Mitrovic
__FILE__? On 9/4/12, Ellery Newcomer wrote: > anybody know a neat trick to get the module name that a function is > being called in a la > > void foobar(size_t line = __LINE__) { > } > > std.traits.moduleName looks like it almost does it, but it needs a > symbol from the module. >

modulename

2012-09-04 Thread Ellery Newcomer
anybody know a neat trick to get the module name that a function is being called in a la void foobar(size_t line = __LINE__) { } std.traits.moduleName looks like it almost does it, but it needs a symbol from the module.

Re: __traits(moduleName)?

2010-09-08 Thread bearophile
Nick Sabalausky: > Is there some way, maybe with __traits, to get the name of the current > module? See request: http://d.puremagic.com/issues/show_bug.cgi?id=4476 Bye, bearophile

Re: __traits(moduleName)?

2010-09-08 Thread Nick Sabalausky
; import std.stdio; import std.traits; private int _getModuleName_dummy_; void main() { auto moduleName = demangle( mangledName!_getModuleName_dummy_ ) ["int ".length .. $-1-_getModuleName_dummy_.stringof.length]; writeln(moduleName); }

__traits(moduleName)?

2010-09-08 Thread Nick Sabalausky
Is there some way, maybe with __traits, to get the name of the current module?