[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

left to right order of evaluation



Or, "is funcall really considered harmfull?"

Q:

; given:
(defun f ()
  (fset 'g #'h)
  (prog1 (g (i))
   (fset 'g #'h)))

(defun h (ignored)
 "left to right is strict")

(defun i ()
 (fset 'g #'(lambda (ignored) "left to right is violated")))

; Is (F) => "left to right is strict"
;     or => "left to right is violated"

The question is, does common-lisp define the result of (F) in
this case?

This is related to the question of the equivalence of
 (G ...) and (FUNCALL (PROGN #'G) ...)
where I add the PROGN to indicate that I don't want compiler
optimization to determine this.
I've observed that on some machines this equivalence is
rather designed in, that a call of a function and a FUNCALL
are exactly the same instruction sequence, but on some
machines they are very different.

-gjc