Thomas Lumley <[EMAIL PROTECTED]> writes:

> While the rules for constructing the tree are part of the language
> definition, the order of evaluation might not be.  In C, for example, the
> order of evaluation is not specified except to the extent that precedence
> constrains it (and for a few special operators like && and ||).
> 
> FOr an R example, if you do
>       f(plot(a), plot(b))
> 
> it is clear that the plot commands must be evaluated before f() returns if
> their return values are actually used. It is not clear which order the
> plots() appear, and I would say that it shouldn't be part of the language
> definition.

...not to mention that lazy evaluation explicitly makes the order dependent
on the function body:

  f <- function(x,y) {x;y}
  f <- function(x,y) {y;x}

will produce the plots in different order when called as above. Notice
in particular that constructs like

  f(a<-b, a)

are playing with fire, unless you're really, really sure that the 1st
arg is evaluated before the 2nd.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED])             FAX: (+45) 35327907

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to