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

Re: pcl

> The test.lisp file uses with-slots, yet with-slots says it is obsolete.
> In any event I get an error in pcl on kcl when expanding the
> with-slots macro in test.lisp

The syntax of the PCL with-slots does not adhere to the current
version of the CLOS standard. That's why it is "obsolete". PCL has two
forms "with-slots*" and "with-accessors*" which behave the way the
CLOS spec says "with-slots" and "with-accessors" should. Eventually
the obsolete forms will disappear and the "*" version will be renamed.

> The code from test.lisp is:
>     (with-slots (obj)
>       (list x y)))
> PCL>Warning: The with-slots macro is now obsolete.  You should convert to
>          with-slots* or with-accessors* as soon as possible.
> Error: The class of OBJ was not specified and could not
>        be inferred from the lexical context.
> Error signalled by FUNCALL.

This looks like you actually typed in the with-slots form at the top
level, instead of leaving it embedded in the "defmethod". The obsolete
with-slots form doesn't support that type of use without an explicit
specification of the class of "obj". For example,

	(with-slots ((obj :class test-class-1))
	  (list x y))

will work (assuming obj has some global value). Also, with-slots* will
work when typed in directly. That is, typing

	(with-slots* (x y) obj (list x y))

at the top level should work.

	-Rich Fritzson
	 Unisys - Paoli Research Center

	 ARPA: fritzson@prc.unisys.com
	 UUCP: {sdcrdcf, psuvax1, cbmvax}!burdvax!fritzson