allMembers trait for module

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Tue Oct 14 03:10:23 PDT 2014


Hello.

i really really wonder if the following program should ouput what it
outputs:

  version = wtf;
  string listit(alias mod) () {
    foreach (m; __traits(allMembers, mod)) {
      pragma(msg, m);
    }
    return "";
  }
  enum s = listit!(mixin(__MODULE__));

i see this:

  object
  wtf
  listit
  s

the question is: wtf "wtf" is doing here?!

two supplement questions:

1. if it's intended to work like this, why we don't have
isVersionSymbol trait?

2. where is isModuleSymbol trait, for that matter? hacks with
'compiles' aren't funny (and can stop working any time).

and the main question: who i need to kill for such traits to be
approved for acception?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20141014/ce741862/attachment.sig>


More information about the Digitalmars-d mailing list