[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
New "issue" and proposal
- To: Masinter.pa@XEROX.COM
- Subject: New "issue" and proposal
- From: willc%tekchips.CRL@tektronix.tek.com
- Date: 22 Mar 88 12:58:12 PST (Tue)
- Cc: cl-cleanup@SAIL.STANFORD.EDU, firstname.lastname@example.org
Edit history: Version 1 by Clinger (22 March 1988)
CLtL does not say whether the function expression of a call is evaluated
before or after the argument expressions.
Common Lisp does not specify whether the function expression of a call is
evaluated before or after the argument expressions. Programs that rely on
a particular order of evaluation are in error.
(defun foo (x) (+ x 3))
(defun bar () (setf (symbol-function 'foo) #'(lambda (x) (+ x 4))))
(foo (progn (bar) 20))
; may return 23 or 24
This makes the status quo explicit.
TI and Symbolics evaluate the function expression last. Lucid and Coral
sometimes evaluate the function expression first and at other times evaluate
the function expression last.
Cost to implementors:
Cost to users:
Codifies an ambiguity.
Since Common Lisp evaluates argument expressions from left to right, it would
be more consistent for the function expression to be evaluated before the
argument expressions. On the other hand, the evaluation rules for function
expressions are already quite different from the rules for argument
expressions, and nobody in their right mind would write code that depends on
the order of evaluation, so aesthetics should not count for much in this case.
Requiring left to right evaluation would force some implementations to consume
an extra register for many function calls. The efficiency argument seems more
important than the aesthetic argument.