Berki Lukacs Tamas | 2 Dec 2006 20:25
Picon

Re: bug (?) when using macro lambda list keywords in defun


> If someone can point a finger at a place where the &WHOLE is given
> licence to signal an error should it appear in an ordinary
> lambda-list, I'd be quite happy.

(sorry for top-posting, I was not subscribed to the list before)

CLHS section 3.4.1 states that "Implementations are free to provide
additional lambda list keywords. For a list of all lambda list keywords
used by the implementation, see lambda-list-keywords.". IMHO, if you
really want to take the spec literally, the current state of SBCL might be
considered correct, since it provides two lambda list keywords,
&environment and &whole in ordinary lambda lists, both are present in
lambda-list-keywords, and their implementation-specified behavior is that
they signal the SB-INT:BUG condition. Although this is IMHO not too
appropriate. What do you think about this simple patch?

Lukács

Index: compiler/parse-lambda-list.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/src/compiler/parse-lambda-list.lisp,v
retrieving revision 1.15
diff -c -5 -r1.15 parse-lambda-list.lisp
*** compiler/parse-lambda-list.lisp	14 Jul 2005 18:57:01 -0000	1.15
--- compiler/parse-lambda-list.lisp	2 Dec 2006 19:13:47 -0000
***************
*** 102,111 ****
--- 102,113 ----
                   (compiler-error "misplaced &AUX in lambda list: ~S" list))
                 (when auxp
                   (compiler-error "multiple &AUX in lambda list: ~S" list))
                 (setq auxp t
                       state :aux))
+               ((&environment &whole)
+                (compiler-error "~S is not allowed in lambda list: ~S" arg list))
                (t (bug "unknown LAMBDA-LIST-KEYWORD in lambda list: ~S." arg)))
              (progn
                (when (symbolp arg)
                  (let ((name (symbol-name arg)))
                    (when (and (plusp (length name))
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sbcl-help mailing list
Sbcl-help <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sbcl-help

Gmane