modulename

captaindet 2krnk at gmx.net
Wed Sep 5 10:56:30 PDT 2012


On 2012-09-04 15:36, Andrej Mitrovic wrote:
>   9/4/12, Ellery Newcomer<ellery-newcomer at utulsa.edu>  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.

+1 would love this too

so far tried to get away with __FILE__ but this has issues, as noted before.


on a slightly different note, __FILE__ and __LINE__ are not quite doing what they are supposed to do either:

http://dlang.org/template.html
Template Value Parameters
"The __FILE__ and __LINE__ expand to the source file name and line number at the point of instantiation."

unfortunately, they only do this for functions (sort of¹), not for other templates. dunno why, i think it is just not implemented. in fear of code bloat? i don't get this argument though. if you use __FILE__ and such extensively it would be only in debugging scenarios. other than that, you shouldn't have many of those. at least this is the case in my code. and the danger of code bloat with templates is omnipresent, no reason to single out __FILE__ usage.

¹using funtempl(Ps)(As){...}:
+ always works in argument list (As), also in non-templated functions
+ as template parameter (P), works only when called short: funtempl()
- as template parameter(P), this does not work: funtempl!()()


More information about the Digitalmars-d-learn mailing list