Dan Anderson wrote:

> I'm curious how perl "compiles" functions internally.  When the actual C
> code (or ASM equivalent or bytecode or whatever Perl uses) for a
> function is run, is there overhead to the function?  Are functions

what do you mean by "overhead to the function"?

> inlined?

if you are thinking about the C++ inline concept then no, you can't inline a 
function in Perl. however, depends on your function and what it does, Perl 
does try to optimize it for you:

[panda]# perl -MO=Deparse -e 'sub hello(){q.world.} if(hello){die}'
do {
    die
};
-e syntax OK

in this case, you can see the hello call is optimized away.

[panda]# perl -MO=Deparse -e 'sub hello(){0} if(hello){die}'
'???';
-e syntax OK

in this case, everything is optimized away. note this is not the same as 
inline though.

> Does perl lazy compile functions?  (i.e. functions never used
> are never compiled and that is why errors suddenly pop up when using a
> function for the same time).

again, i am not sure exactly what you mean by "lazy compile". these words 
have very different meaning for different people. i am guessing that you 
are thinking about something along the line of Autoload or compile vs. 
runtime stuff like:

[panda]# perl -ce 'print _not_a_real_function()'
-e syntax OK
[panda]# perl -e 'print _not_a_real_function()'
Undefined subroutine &main::_not_a_real_function called at -e line 1.

david
-- 
s,.*,<<,e,y,\n,,d,y,.s,10,,s
.ss.s.s...s.s....ss.....s.ss
s.sssss.sssss...s...s..s....
...s.ss..s.sss..ss.s....ss.s
s.sssss.s.ssss..ss.s....ss.s
..s..sss.sssss.ss.sss..ssss.
..sss....s.s....ss.s....ss.s

,....{4},"|?{*=}_'y!'+0!$&;"
,ge,y,!#:$_(-*[./<[EMAIL PROTECTED],b-t,
.y...,$~=q~=?,;^_#+?{~,,$~=~
y.!-&*-/:[EMAIL PROTECTED] ().;s,;,
);,g,s,s,$~s,g,y,y,%,,g,eval

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to