On May 31, 11 03:32, Robert Clipsham wrote:
On 30/05/2011 20:08, Andrei Alexandrescu wrote:
On 05/30/2011 01:02 PM, Walter Bright wrote:
On 5/30/2011 9:59 AM, Jose Armando Garcia wrote:
Walter, what do you think about adding __MODULE__ to the language? It
will work similar to __FILE__ and __LINE__ but instead get replaced by
the name of the module. This would be really useful for std.log's
verbosity filtering feature.

I don't know. I know I am leery of just adding more and more stuff like
this.

Gnu's and subsequently C++0x's experience with __FUNCTION__ and
__PRETTY_FUNCTION__ has shown that the effects are beneficial.


Andrei

Pull request #75 adds __traits(moduleOf) which allows you to get the
module/package of a given symbol - I figure adding a trait is better
than adding more ugly __FOOBAR__ nonsense (not that __traits() is the
nicest syntax of course ;)).


The advantage of __NONSENSE__ is that, by convention, the token will be evaluated at instantiation site instead of definition site in a parameter default:

    template T(alias modName=__MODULE__) {
       ...

how would __traits(moduleOf, ...) deal with this?

Reply via email to