On 24 Apr 2002, at 20:20, david nicol reading obsolescent UMKC mail wrote:

> [EMAIL PROTECTED] wrote:
> 
> > Yeah, but does Perl actually garantee it will evaluate the
> > left operand of arithmetic operators first? If so, I cannot
> > find it in the documentation.
> 
> there's a strong tradition of single-threaded evaluation
> and also in order to have leftward binding as promised in
> perldoc perlop you have to evaluate the left term first in
> order to decide what operator to use.  Are there examples 
> of out-of-order evaluation that does not involve buffering?

I can't comment on how perl handles this, but you were a little unclear 
about *what* "strong tradition" you were referring to.  In ancient C 
[dunno about the current C spec.. haven't done any real C programming in 
a long time], the compiler *explicitly* reserved the right to rearrange 
expressions as it saw fit.

In the construct:    f(a) + g(b)      the compiler has the prerogative to 
evaulate whichever it pleased first [and so you couldn't count on 
function 'f' being called before function 'g'].  I would have guessed 
that Perl's expression evaluator would have inherited that "tradition" 
from C.

[this all from hazy memory [from having *written* a C compiler for a new 
processor once, many many moons ago], but my copies of K&R are long-since 
packed away... is there a C-spec available online someplace?  but I'm 
really quite sure that the C spec is explict in that the order of 
evaluation of the operands to binary operators is unspecified].

  /Bernie\
-- 
Bernie Cosell                     Fantasy Farm Fibers
mailto:[EMAIL PROTECTED]     Pearisburg, VA
    -->  Too many people, too few sheep  <--          

Reply via email to