Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
P is for Practical
 
PerlMonks  

Re: eval inside an object

by g0n (Priest)
on Apr 28, 2005 at 05:34 UTC ( [id://452241]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to eval inside an object

Slightly OT, but probably worth mentioning. Eval is indeed cool, but it has its evil side. E.g the following code:

#code a my $function = $node->{'activationfunction'}; my $functionCall ="\$value = \$network->$function(\$value);"; eval($functionCall); #code b my $function = $node->{'activationfunction'}; $value = $network->$function($value);

Eval saved me once upon a time from having to learn that code b was possible. BUT, since I was calling this tens of thousands of times in normal program execution, and hence invoking the compiler every time, once I did learn that code b was possible, the program speeded up by several hundred fold!

The moral - eval is cool, but very very slow!

g0n, backpropagated monk

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://452241]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.