Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^2: Conditional Compiling

by ikegami (Patriarch)
on Nov 17, 2004 at 21:52 UTC ( [id://408610]=note: print w/replies, xml ) Need Help??


in reply to Re: Conditional Compiling
in thread Conditional Compiling

Because log(...) if LOGGING compiles to nothing given sub LOGGING () { 0 } (refer to the first parse tree in the OP), whereas, log(...) if $LOGGING would cause $LOGGING to be evaluated at runtime everytime the line is encountered. While that's probably a negligable cost, it doesn't meet the goal I set at the top of my post. That goal can be alternatively stated as "I want the if to execute at compile time instead of at run-time (while keeping the code simple)."

Replies are listed 'Best First'.
Re^3: Conditional Compiling
by Arunbear (Prior) on Nov 18, 2004 at 11:34 UTC
    Ok, I get it now. It's quite a cool technique which is also used by Carp::Assert (for disabling assertions).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://408610]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-04-19 16:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found