Templates and stringof...

Era Scarecrow rtcvb32 at yahoo.com
Sat Aug 4 01:09:34 PDT 2012


On Saturday, 4 August 2012 at 07:57:46 UTC, Philippe Sigaud wrote:
> FWIW, I agree with David that using .stringof is a last resort 
> and can lead to nasty bugs. .stringof has a sometime incoherent 
> behavior (I remember it showing the entire code inside a 
> delegate literal)

>
> But then, the code shown upstream do *not* use .stringof.
>
> It uses __traits(parent, ) and __traits(qualifier, ), which are 
> much more 'modern' and well-behaved.

> For std.reflection that Andrei proposed 2 weeks ago, I feel the 
> internal code will contain many __traits() calls. Nothing to be 
> done about it. __traits is *the* way compile-time introspection 
> is done in D.

  If traits will work, then that's what we go with. I've already 
got a workaround for what I need, a template creating a mixin, 
that you use a mixin on to make the bitfields; not pretty, but it 
will do the job; at least until a better option shows itself, 
preferably in a template in std.traits I can use and not go 
lower-level than I have to.

  Sorry if I've taken up unnecessary time.


More information about the Digitalmars-d-learn mailing list