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
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.
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
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
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
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.
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
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
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
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,
e now have std.traits.moduleName, so presumably that will
do the trick.
- Jonathan M Davis
moduleName needs a symbol
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?
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
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.
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"
__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.
>
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.
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
;
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);
}
Is there some way, maybe with __traits, to get the name of the current
module?
20 matches
Mail list logo