Hi Vin --
We’ve been running with Jerry’s code below in 21.5 since 2004, and it’s not
on the face of it very risky. It is something I need for a 21.5 change I
want to make, though, in order for the packages built with 21.4 to continue
to not throw random errors with 21.5.
The gory details are that I have added C support for multiple values, and if
the package byte code tries to call #'values or #'multiple-value-list at
runtime (which it does if #'values is implemented as an alias for #'list,
for example), it will get inconsistent behaviour with itself on 21.5. If it
uses the inline expansion, the functions themselves won’t be called at
runtime.
Best,
Aidan
2009-08-09 Aidan Kehoe <kehoea(a)parhasard.net>
* cl.el (values):
* cl.el (values-list):
* cl.el (multiple-value-list):
* cl.el (multiple-value-apply):
* cl.el (multiple-value-call):
* cl.el (nth-value):
Make most of these defsubsts, not aliases, so the byte-code
generated doesn't try to call #'values or #'multiple-value-list at
runtime; now that these do useful things in 21.5, we need to avoid
that if we want to compile code that will work there.
--- lisp/cl.el~ 2004-06-22 02:49:47.001000000 +0100
+++ lisp/cl.el 2009-08-09 14:49:06.703125000 +0100
@@ -248,12 +248,41 @@
;;; simulated. Instead, multiple-value-bind and friends simply expect
;;; the target form to return the values as a list.
-(defalias 'values 'list)
-(defalias 'values-list 'identity)
-(defalias 'multiple-value-list 'identity)
-(defalias 'multiple-value-call 'apply) ; only works for one arg
-(defalias 'nth-value 'nth)
+(defsubst values (&rest values)
+ "Return multiple values, Common Lisp style.
+The arguments of `values' are the values
+that the containing function should return."
+ values)
+
+(defsubst values-list (list)
+ "Return multiple values, Common Lisp style, taken from a list.
+LIST specifies the list of values
+that the containing function should return."
+ list)
+(defsubst multiple-value-list (expression)
+ "Return a list of the multiple values produced by EXPRESSION.
+This handles multiple values in Common Lisp style, but it does not
+work right when EXPRESSION calls an ordinary Emacs Lisp function
+that returns just one value."
+ expression)
+
+(defsubst multiple-value-apply (function expression)
+ "Evaluate EXPRESSION to get multiple values and apply FUNCTION to them.
+This handles multiple values in Common Lisp style, but it does not work
+right when EXPRESSION calls an ordinary Emacs Lisp function that returns just
+one value."
+ (apply function expression))
+
+(defalias 'multiple-value-call 'apply) ; only works for one arg; not
+ ; used in any of the packages.
+
+(defsubst nth-value (n expression)
+ "Evaluate EXPRESSION to get multiple values and return the Nth one.
+This handles multiple values in Common Lisp style, but it does not work
+right when EXPRESSION calls an ordinary Emacs Lisp function that returns just
+one value."
+ (nth n expression))
;;; Macros.
--
hi there!
--
¿Dónde estará ahora mi sobrino Yoghurtu Nghe, que tuvo que huir
precipitadamente de la aldea por culpa de la escasez de rinocerontes?
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches