[Ecls-list] SI:QUASIQUOTE meets CASE during COMPILE-FILE
Juan Jose Garcia-Ripoll
jjgarcia at users.sourceforge.net
Thu Apr 10 11:10:14 UTC 2008
On Wed, Apr 9, 2008 at 8:09 PM, Samium Gromoff
<_deepfire at feelingofgreen.ru> wrote:
> Good day folks,
>
> During another session of porting my project to ECL, I was confronted
> with what appears to be a conflict between quasiquotology and CASE,
> which only appears during LOADing a COMPILE-FILE'd source,
> but not during COMPILE or LOAD-as-source.
>
> I've narrowed it down to the following:
>
> foo.lisp: --- 8< ---
> (defun foo (param)
> (case param
> `',@(list)
> (t nil)))
I am positively sure you are not allowed to do this. It may be that,
due to the macro expansion they use, SBCL and CLISP makes this work,
but it is not legal. The arguments to CASE must be static forms. The
quasiquote form is creating a lisp form that creates a list which is
equivalent to the one you are trying to build, but this is any form
and it has to be evaluated
This is clear about that:
http://www.lisp.org/HyperSpec/Body/sec_2-4-6.html
"An implementation is free to interpret a backquoted form F1 as any
form F2 that, when evaluated, will produce a result that is the same
under equal as the result implied by the above definition,"
However, this is inconsistent with the fact that CASE does not evalute
the lists that form the different options. Indeed these lists have to
have a precise structure: (key-designattor {forms}*) which may not be
the one that quasiquote produces.
Juanjo
--
Facultad de Fisicas, Universidad Complutense,
Ciudad Universitaria s/n Madrid 28040 (Spain)
http://juanjose.garciaripoll.googlepages.com
More information about the ecl-devel
mailing list