<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.3.2">
</HEAD>
<BODY>
Thank you, Andrew.<BR>
<BR>
This seems very relevant to a problem that Waldo Rubinstein is trying to solve under OpenMCL.<BR>
<BR>
The following code breaks on OpenMCL at the first accessor try:<BR>
<BR>
<TABLE BGCOLOR="#adadad" CELLSPACING="0" WIDTH="100%">
<TR>
<TD>
<TABLE BGCOLOR="#ffffff" CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
(asdf:operate 'asdf:load-op :elephant)<BR>
(asdf:operate 'asdf:load-op :ele-bdb)<BR>
(asdf:operate 'asdf:load-op :elephant-tests)<BR>
(in-package "ELEPHANT-TESTS")<BR>
<BR>
(open-store *testdb-path*)<BR>
<BR>
<BR>
<BR>
      (defclass update-class () <BR>
((slot1 :initform 1 :accessor slot1))<BR>
(:metaclass persistent-metaclass))<BR>
(setq *auto-commit* t)<BR>
(setq foo (make-instance 'update-class :sc *store-controller*))<BR>
(slot1 foo)<BR>
(defclass update-class ()<BR>
  ((slot2 :initform 2 :accessor slot2))<BR>
  (:metaclass persistent-metaclass))<BR>
(slot2 foo)<BR>
(slot1 foo)<BR>
<BR>
<BR>
Waldo, execute the above code under OpenMCL.<BR>
It should fail on the last statement, but I suspect it will fail on (slot2 foo).<BR>
Send me the transcript.
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
<BR>
I wonder if what that does under ACL?  I will attempt to run the code you sent me today under SBCL.<BR>
<BR>
It is clear that there are some implementation-specific differences that are tripping us up on these <BR>
features (which, after all, are very advanced; one cannot contemplate dynamically changing a class<BR>
definition under Java!)  <BR>
<BR>
On Tue, 2006-01-10 at 15:15 -0800, Andrew Philpot wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">I wrote:</FONT>

<FONT COLOR="#000000">  Finally, I think things are working enough to prototype making my</FONT>
<FONT COLOR="#000000">  knowledge base persistent.  Yet, I still get lots of segmentation</FONT>
<FONT COLOR="#000000">  faults and seeming configuration level errors such as "The slot SLOT1</FONT>
<FONT COLOR="#000000">  is missing from the object #<PFOO @ #x720bb22a> of class</FONT>
<FONT COLOR="#000000">  #<PERSISTENT-METACLASS PFOO> during operation SETF."  I'm mostly</FONT>
<FONT COLOR="#000000">  unclear as to why code which works inside a RT:DEFTEST doesn't always</FONT>
<FONT COLOR="#000000">  work at top level, or in my client code.  I seem to do a lot of</FONT>
<FONT COLOR="#000000">  deleting the database, stopping lisp, rebuilding elephant, and trying</FONT>
<FONT COLOR="#000000">  my example again.  I fear I'm corrupting either the BDB store, the</FONT>
<FONT COLOR="#000000">  local Lisp connection to it, and/or CLOS with my missteps.  Symptoms</FONT>
<FONT COLOR="#000000">  are things like [sic]</FONT>

<FONT COLOR="#000000">I left out the symptoms before.  Sorry.</FONT>

<FONT COLOR="#000000">I've since gone further, and so I have a sample case that I would like</FONT>
<FONT COLOR="#000000">to show you.  I would be interested in whether this happens on other</FONT>
<FONT COLOR="#000000">platforms as well.  Again, if it comes down a question of why doesn't</FONT>
<FONT COLOR="#000000">YYY work on ACL as it does on SBCL et al, I can submit to Franz.</FONT>

<FONT COLOR="#000000">Essentially, I have found that reDEFCLASSing persistent classes tends</FONT>
<FONT COLOR="#000000">to stir things up in a way that slots are no longer visible after the</FONT>
<FONT COLOR="#000000">redefinition.  Mostly by accident, I also found that explicitly</FONT>
<FONT COLOR="#000000">calling CLOS::FINALIZE-INHERITANCE after the redefinition and before</FONT>
<FONT COLOR="#000000">any use of the class usually does the right thing.</FONT>

<FONT COLOR="#000000">See the attached code and transcript, abstracted from my real</FONT>
<FONT COLOR="#000000">application.  If you set the variable user::*EAGERLY-FINALIZE* to</FONT>
<FONT COLOR="#000000">non-NIL, then at COMPILE/LOAD/EVAL it will try to finalize the</FONT>
<FONT COLOR="#000000">definition (if such already exists).  I'm trying to be</FONT>
<FONT COLOR="#000000">hyperconservative about when to define things, so that's why it does</FONT>
<FONT COLOR="#000000">OPEN-STORE/CLOSE-STORE so globally before tinkering with the</FONT>
<FONT COLOR="#000000">definitions.</FONT>

<FONT COLOR="#000000">#Andrew</FONT>

</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>