string file = __FILE__ considered harmful (and solution)
Steven Schveighoffer
schveiguy at yahoo.com
Thu May 31 13:53:12 UTC 2018
On 5/31/18 7:14 AM, bauss wrote:
> Instead of these hack keywords.
>
> Perhaps a __traits() in the compiler with the information would be
> better suited like:
>
>
> void foo()
> {
> enum caller = __traits(getCaller);
>
> ....
> }
>
> getCaller would return a compile-time struct with additional information
> about the current module and the module/function it was called from.
How can this be possible? When inside the function, you have no idea
where you were called from.
-Steve
More information about the Digitalmars-d
mailing list