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

left to right order of evaluation



If I understand your question (not easy, since you use things like FSET
that are not defined in Common Lisp), you are asking whether, in a
normal function call like "(g (foo))", the mapping from the symbol G to
its definition occurs before or after the call to FOO, which might
change the definition of G as a side-effect.

I don't think that the manual currently addresses this issue.
I would advocate leaving this decision to the implementor, since I know
of at least one implementation that would be badly screwed if either
decision were mandated.  Put another way, I'm proposing that it "is an
error" in portable code to change the definition of a symbol while
computing the arguments in a normal call to that symbol, and the results
will be unpredictable if you do this.  I suppose the "right" thing is to
do the SYMBOL-FUNCTION of G before computing the args, but specifying
this would limit the flexibility available to the implementor in a place
where tricks can buy you a LOT.

The funcall case is different, I think.  In something like "(funcall #'g
(foo))", the translation of the symbol G to a function object clearly
occurs when (function 'G) is evaluated, and nothing that FOO does to G
(short of destructively modifying its definition) can alter that after
the fact.

-- Scott