Ron Garret <rNOSPAMon@flownet.com> wrote:
+---------------
| Ron Garret <rNOSPAMon@flownet.com> wrote:
| > I mostly use CLisp for compatibility tests
|
| I note with a certain wry amusement that (ignore-errors (function
| ignore-errors)) returns NIL in CLisp even in compiled code.
+---------------
You need to look at the *second* value, too, which per the CLHS
entry for IGNORE-ERRORS contains the condition resulting from the
error [if any]. E.g., in CLISP:
[1]> (ignore-errors (function ignore-errors))
NIL ;
#<SYSTEM::SIMPLE-UNDEFINED-FUNCTION #x203FB779>
[2]>
or CMUCL:
cmu> (ignore-errors (function ignore-errors))
; In: IGNORE-ERRORS #'IGNORE-ERRORS
; #'IGNORE-ERRORS
; Error: Found macro name IGNORE-ERRORS as the argument to FUNCTION.
;
NIL
#<KERNEL:SIMPLE-PROGRAM-ERROR {589054B5}>
cmu>
Though compiled CLISP's behavior is a bit "different":
[3]> (defun foo () (ignore-errors (function ignore-errors)))
FOO
[4]> (compile *)
FOO ;
NIL ;
NIL
[5]> (foo)
#<MACRO #<COMPILED-CLOSURE IGNORE-ERRORS>>
[6]>
CMUCL, while complaining mightily during the COMPILE, still returns
two reasonable values in the compiled case:
cmu> (defun foo () (ignore-errors (function ignore-errors)))
FOO
cmu> (compile *)
; In: LAMBDA NIL
; #'IGNORE-ERRORS
; Error: Found macro name IGNORE-ERRORS as the argument to FUNCTION.
;
; Compiling LAMBDA NIL:
; Compiling Top-Level Form:
; Compilation unit finished.
; 1 error
FOO
T
T
cmu> (foo)
NIL
#<KERNEL:SIMPLE-PROGRAM-ERROR {58947CA5}>
cmu>
-Rob
-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607