Juan Jose Garcia-Ripoll | 26 Dec 16:26 2011

Wrong test?

(MACROLET ((%M (Z)
                   Z))
        (CTYPECASE (EXPAND-IN-CURRENT-ENV (%M :FOO))
          (INTEGER :BAD1)
          (KEYWORD :GOOD)
          (SYMBOL :BAD2)))

What is this supposed to check? In ECL this leads to the following code

(CTYPECASE :FOO
          (INTEGER :BAD1)
          (KEYWORD :GOOD)
          (SYMBOL :BAD2)))

This is in my opinion wrong.. CTYPECASE is supposed to contain a form for a correctable error, including a replacement of the value of the form, in this case :FOO. This means CTYPECASE expands at some point to (SETF :FOO ...) which is not a valid code, given that :FOO is a constant.

I know that SBCL and probably other implementations do not complain about this until the assignment is performed, but this does not mean that the code is valid.

Juanjo

--
Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
http://juanjose.garciaripoll.googlepages.com
_______________________________________________
ansi-test-devel mailing list
ansi-test-devel <at> common-lisp.net
http://lists.common-lisp.net/cgi-bin/mailman/listinfo/ansi-test-devel

Gmane