Can you do this in D?
bearophile
bearophileHUGS at lycos.com
Thu Jul 26 06:12:59 PDT 2012
Wes:
> So basically there's no easy way to make a prettyprint like:
> foreach(field;__traits(allFields, myClass)) { str ~= field; }
I am saying that probably there is a way, using mixins.
> Assuming this is the same as #pragma (msg, "").
It's not the same. It's usable just like a writeln, but in CTFE
too. pragma(msg) has a different behavour, and happens in a
different compilation stage.
> I'm not sure what you mean. Do you mean I can go edit the open
> source compiler and add in my own language feature? Or does the
> ability to add a $/@ operator already exist?
I mean that D compiler writers don't need to introduce new syntax
to add that feature. But I don't see lot of people asking for it.
Bye,
bearophile
More information about the Digitalmars-d
mailing list