develooper Front page | perl.perl5.porters | Postings from March 2000

Re: [ID 20000324.027] Conditionally evaluated subroutines

Tom Christiansen
March 24, 2000 06:51
Re: [ID 20000324.027] Conditionally evaluated subroutines
Message ID:
>> He probably doesn't understand that eval{} is just do{} with exception
>> handling.   That is, it's a compile thing.

>Its not that I don't understand it -- I just thought that its strange
>behaviour.  Certainly not what I expected.  Thanks for the explanation

Similar to this is the way people get confused about

    if (1) {
	use Thing_One;
    } else { 
	use Thing_Two;

Like a sub declaration, use is a compile-time declaration, so its
effect is unrelated to its placement.  it makes no difference to
the compiler what happens at run-time.  (Although you'd think that
the second block might be optimized away, that happens to late.)

--tom Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About