mixins: Shouldn't this work?

mike vertex at gmx.at
Wed Jan 3 15:49:37 PST 2007


Am 04.01.2007, 00:27 Uhr, schrieb Kirk McDonald  
<kirklin.mcdonald at gmail.com>:

> Mixins are for mixing-in declarations, not statements. What you're doing  
> is this:
>
> float foo(float x, float y) {
>      mixin trace!("foo");
>      return x / y;
> }
>
> Becomes:
>
> float foo(float x, float y) {
>      void trace() {
>          scope (failure) writefln("Trace: ", "foo");
>      }
>      return x / y;
> }
>
> See? The "scope (failure)" is inside a nested function. It applies to  
> the scope of that function, and doesn't help one iota. :-)

Ow! I see. So no way to do that?

-mike

-- 
Erstellt mit Operas revolutionärem E-Mail-Modul: http://www.opera.com/mail/



More information about the Digitalmars-d mailing list