Re: getting the class name from a symbol name

From: Erick Gallesio <eg_at_saxo.essi.fr>
Date: Mon, 17 Mar 1997 12:15:11 +0100

> Brian Denheyer writes
> If I have a class <Point> and I have a symbol '<Point> is there any
> way to get the class indentifier type using the symbol. The obvious
> application for this is that I could read a file :
>
> <Point> 1.0 2.0
>
> And, having read the class name, I could then create an instance of
> the class and have the method which is defined for reading <Point>'s
> automagically be invoked to read the next 2 values.
>
> Is this possible ?

Yes. You can just evaluate what you have the class name and it should
contain the class meta object (I said should because you can change the
value of the <Point> variable to another object if you want). In fact make is
a standard lambda which evaluataes all its arguments.

>
> If not what would be a good way to accomplish this ? I'm thinking a
> hash table of class name/classes.
>

I think that it is better to use the MOP to create a form which when read back
will yield a new object (i.e. you put something like
     (make <Point> :x 1.0 :y 2.0)
in your file.
This has already been disussed in the mailing list. See:
       http://kaolin.unice.fr/Mlist/Hypermail/1146.html


                -- Erick
Received on Mon Mar 17 1997 - 12:16:39 CET

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST