Keith Ivey schreef:
> Dr.Ruud:
>> Greg Matheson:
>>> A. Pagaltzis:

>>>> Write the same thing without syntactic sugar from constant.pm.
>>>>     sub C1     () { 'C1' }
>>>
>>> Mmh. I see constant.pm does very little.
>> 
>> Well, it nicely sets things up for the compiler to optimize.
>> 
>> perl -MO=Deparse -e 'use constant PI => 3.1415; print PI'
>> use constant ('PI', 3.1415);
>> print 3.1415;
>> -e syntax OK
> 
> Greg's version gets optimized as well:
> 
> perl -MO=Deparse -e'sub PI () {3.1415} print PI'
> sub PI () { 3.1415 }
> print 3.1415;
> -e syntax OK

Of course, because that is what constant basically does for you. 

-- 
Affijn, Ruud

"Gewoon is een tijger."

Reply via email to