[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.lisp

Changing a structure to a class

Jim Ottaway

12/1/2015 3:19:00 PM


I have been working on something with a defstruct, but now I see it
would be better if it were a class.

Apart from restarting my Lisp instance, is there any way of redefining a
structure of a given name as a class with the same name?

When I try this (using SBCL) I get this error:

Cannot CHANGE-CLASS objects into CLASS metaobjects.
[Condition of type SB-PCL::METAOBJECT-INITIALIZATION-VIOLATION]


Yours sincerely,
--
Jim Ottaway
2 Answers

Pascal J. Bourguignon

12/1/2015 5:13:00 PM

0

Jim Ottaway <jeho@jeho.org> writes:

> I have been working on something with a defstruct, but now I see it
> would be better if it were a class.
>
> Apart from restarting my Lisp instance, is there any way of redefining a
> structure of a given name as a class with the same name?

No, there is not.


> When I try this (using SBCL) I get this error:
>
> Cannot CHANGE-CLASS objects into CLASS metaobjects.
> [Condition of type SB-PCL::METAOBJECT-INITIALIZATION-VIOLATION]

But what you can do without restarting the lisp instance, is to unintern
all the symbols defined by defstruct, define the class, and recompile
all the code that depends on it.

--
__Pascal Bourguignon__ http://www.informat...
â??The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.� -- Carl Bass CEO Autodesk

Jim Ottaway

12/1/2015 8:28:00 PM

0

>>>>> Pascal J Bourguignon <pjb@informatimago.com> writes:
> But what you can do without restarting the lisp instance, is to
> unintern all the symbols defined by defstruct, define the class, and
> recompile all the code that depends on it.

Yes, that works fine. Thank you.

Yours sincerely,
--
Jim Ottaway