[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: KCL bug: ETYPECASE and &ENVIRONMENT





>	As was reported in ..., the ETYPECASE
>	macro tests the arms in reverse order. ....
>
>		Pavel

There was a bug in the definition of ETYPECASE in file lsp/assert.lsp.
I just forgot to REVERSE the given clauses at the very beginning of the
DO loop in the definition.  To fix the bug, surround "clauses" with
"reverse" as follows. 

	(defmacro etypecase (keyform &rest clauses &aux (key (gensym)))
=>	   (do ((l (reverse clauses) (cdr l))
	        (form `(error (typecase-error-string
	                       ',keyform ,key
	                       ',(mapcar #'(lambda (l) (car l)) clauses)))))
	       ((endp l) `(let ((,key ,keyform)) ,form))
	       (setq form `(if (typep ,key ',(caar l))
	                       (progn ,@(cdar l))
	                       ,form))
	       )
	   )

-- Taiichi