On 1/9/03 9:01 PM, Luke Palmer wrote:
> Well, I just do:
> 
> sub debug {
>   print STDERR shift, "\n" if DEBUG;
> }
> 
> And hopefully (I don't know P5 internals so well) that optimizes to a
> no-op so there's not even a function call there.

I don't know P5 internals so well either, but I'm guessing you'll still get
the function call to debug().

> But it's a negligible overhead anyway.

Hey, it adds up!  Okay, maybe it doesn't...but still, Perl 6 Should Be Able
To Do This! :)  And I'd also like inline constructs like:

    ASSERT $foo > 5 && is_happy(blah);

that may or may not be the same as the debug situation in Perl 6.
 
> I don't see how you could do much without actually labeling what you
> wanted to disappear.

I basically want a language-level guarantee that the call to debug()
disappears entirely under certain conditions.  I don't want to have to rely
on details of the optimizer or whatever.

-John

Reply via email to