Re: Help with metaclass definitions



In article
<30968e93-865c-45ec-bad6-bb997a78634a@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
vttoonses <vttoonses@xxxxxxxxx> wrote:

I know I am probably messing in areas I shouldn't be (based on my
limited knowledge of Common Lisp), but I have a desire to create an
object to xml marshaller. Basically, I am building a webapp that has a
RESTful interface that a javascript and flex based UI is communicating
with.

Originally, I thought to create my response objects and have generic
functions that generated xml for each one. Then I thought, "Why do
that if I can write code to examine each object's structure and data?
Then I could write generalized code to convert any object to xml." A
little research into MOP and I was soon able to extract almost all the
information I needed. The only aspect that I need is to know whether a
data item is a child node, text, or attribute.

I've initially solved this by using the :documentation key for each
slot. I just put an indicator in there and when the marshaller is
examining the object, it pulls this data. This is ok and works, but
I'm hijacking a key for my own purposes. I'd rather be able to define
my own slot key(s) for the meta information the marshaller needs (node
type, namespace, etc).

Now we (finally) get to my issue - I've determined that I need to
define a meta class so that I may define my own slot keys.
Unfortunately, I'm receiving an error when attempting this.

(defclass my-meta-class (standard-class) ())

gives the following - (DEFCLASS MY-META-CLASS): superclass #<STRUCTURE-
CLASS STANDARD-CLASS> should be of class STANDARD-CLASS

I am using clisp 2.33 on windows (Lisp in a box) and Clozure CL on OSX
(leopard) and get the same in each case. Either they both have the
same issue or (much more likely) I'm doing something wrong. Any help
would be greatly appreciated. Additionally, if there is already a
mapping tool available that I should be using that someone knows
about, please let me know.

Thanks,
Gene

Maybe you need to update your Lisp implementations?
I don't get an error in CLISP 2.45 and CCL 1.2.

--
http://lispm.dyndns.org/
.