From randall at randallsquared.com Thu Sep 16 23:26:45 2004 From: randall at randallsquared.com (Randall Randall) Date: Thu, 16 Sep 2004 19:26:45 -0400 Subject: [cl-prevalence-devel] Using strings as root keys? Message-ID: Hi, all. I'm just starting to play with cl-prevalence. Is there any reason (besides performance, which I know would suffer with EQUAL or EQUALP) why the root-objects hash in a system is EQ? -- Randall Randall 'I say we put up a huge sign next to the Sun that says "You must be at least this big (insert huge red line) to ride this ride".' -- tghdrdeath at hotmail.com From scaekenberghe at common-lisp.net Fri Sep 17 18:35:26 2004 From: scaekenberghe at common-lisp.net (Sven Van Caekenberghe) Date: Fri, 17 Sep 2004 20:35:26 +0200 Subject: [cl-prevalence-devel] Using strings as root keys? In-Reply-To: References: Message-ID: <57C7B936-08D8-11D9-ADD3-000A95B3E0D2@common-lisp.net> On 17 Sep 2004, at 01:26, Randall Randall wrote: > Hi, all. > > I'm just starting to play with cl-prevalence. > > Is there any reason (besides performance, which > I know would suffer with EQUAL or EQUALP) why > the root-objects hash in a system is EQ? I honestly can't remember why I did this, but in CL using symbols as keys is free (as in doesn't cost you anything) *and* it is efficient. I generally use 'managed prevalence' where the root keys are class names (and thus symbols). Why would you want to use a string instead of a symbol ? Sven From randall at randallsquared.com Fri Sep 17 19:33:16 2004 From: randall at randallsquared.com (Randall Randall) Date: Fri, 17 Sep 2004 15:33:16 -0400 Subject: [cl-prevalence-devel] Using strings as root keys? In-Reply-To: <9BD33738-08D7-11D9-ADD3-000A95B3E0D2@beta9.be> References: <9BD33738-08D7-11D9-ADD3-000A95B3E0D2@beta9.be> Message-ID: <6C23773C-08E0-11D9-AAEC-000A95A0F1E8@randallsquared.com> On Sep 17, 2004, at 2:30 PM, Sven Van Caekenberghe wrote: > Why would you want to use a string instead of a symbol ? Possibly because I didn't understand that the root objects are supposed to be containers for most of the actual data structures, rather than those data structures directly. I actually don't see any need for that now. I should have read more source before asking questions. :) Thanks! -- Randall Randall Property law should use #'EQ , not #'EQUAL . From randall at randallsquared.com Sun Sep 19 09:09:21 2004 From: randall at randallsquared.com (Randall Randall) Date: Sun, 19 Sep 2004 05:09:21 -0400 Subject: [cl-prevalence-devel] Another simple question Message-ID: <97D224E0-0A1B-11D9-B94B-000A95A0F1E8@randallsquared.com> In looking through managed-prevalence.lisp, it appears that the "unique" id counter isn't saved in the transaction log. Is this an oversight, or a feature I don't understand? :) The relevant section is copied in below: (defun tx-create-id-counter (system) "Initialize the id counter to 0" (setf (get-root-object system :id-counter) 0)) (defmethod next-id ((system prevalence-system)) "Increment and return the next id" (incf (get-root-object system :id-counter))) -- Randall Randall Property law should use #'EQ , not #'EQUAL . From randall at randallsquared.com Sun Sep 19 22:15:59 2004 From: randall at randallsquared.com (Randall Randall) Date: Sun, 19 Sep 2004 18:15:59 -0400 Subject: [cl-prevalence-devel] Fwd: Another simple question Message-ID: <7C74A104-0A89-11D9-BDC4-000A95A0F1E8@randallsquared.com> I wrote: > In looking through managed-prevalence.lisp, it > appears that the "unique" id counter isn't saved > in the transaction log. Is this an oversight, > or a feature I don't understand? :) The latter, it would appear, since next-id is only called from inside a transaction. My apologies for the noise. -- Randall Randall Property law should use #'EQ , not #'EQUAL . From scaekenberghe at common-lisp.net Mon Sep 20 06:50:02 2004 From: scaekenberghe at common-lisp.net (Sven Van Caekenberghe) Date: Mon, 20 Sep 2004 08:50:02 +0200 Subject: [cl-prevalence-devel] Fwd: Another simple question In-Reply-To: <7C74A104-0A89-11D9-BDC4-000A95A0F1E8@randallsquared.com> References: <7C74A104-0A89-11D9-BDC4-000A95A0F1E8@randallsquared.com> Message-ID: <4BE95C87-0AD1-11D9-BD46-000A95B3E0D2@common-lisp.net> On 20 Sep 2004, at 00:15, Randall Randall wrote: > I wrote: >> In looking through managed-prevalence.lisp, it >> appears that the "unique" id counter isn't saved >> in the transaction log. Is this an oversight, >> or a feature I don't understand? :) > > The latter, it would appear, since next-id is only > called from inside a transaction. My apologies > for the noise. > Indeed. It is however necessary to call (execute-transaction (tx-create-id-counter)) once before starting to use a newly created prevalence system for the first time, otherwise the counter is uninitialized. Sven From randall at randallsquared.com Mon Sep 27 06:47:28 2004 From: randall at randallsquared.com (Randall Randall) Date: Mon, 27 Sep 2004 02:47:28 -0400 Subject: [cl-prevalence-devel] problems with restoration (long) Message-ID: <18ED236A-1051-11D9-B422-000A95A0F1E8@randallsquared.com> So, I've been using cl-prevalence, and like it, mostly. :) I have 3 systems active in my application (with at least 2 more expected before it will be completely converted). Two of them restore correctly. One reliably does not, and while the fact that two work okay suggests that the problem is in my code, I can't find one. When I change prevailed objects, they seem to update in the log. However, deeply nested objects seem not to be restored correctly. The classes involved are: (defclass page (object-with-id) ((name :initarg :name :initform "" :accessor name) (title :initarg :title :initform () :accessor title)) (:documentation "")) (defclass xhtml-page (page) ((xhtml :initarg :xhtml :initform () :accessor xhtml))) (defclass classroom (object-with-id) ((cover :initarg :cover :initform "" :accessor cover) (toc :initarg :toc :initform () :accessor toc) (pages :initarg :pages :initform (make-hash-table :test 'equal) :accessor pages)) (:documentation "")) (defclass course (accessible) ((name :initarg :name :initform "" :accessor name) ; used as a human-readable id (title :initarg :title :initform "" :accessor title) ; shown to users as the title of the course (classroom :initarg :classroom :initform () :accessor classroom) (menu :initarg :menu :initform () :accessor menu)) (:documentation "")) The "accessible" class just has some permissions control, which works okay; I'm sure it's not essential to this problem. When I create a course, giving it a classroom, with a single xhtml-page in the pages hash, this is the XML output: CL-PREVALENCE::TX-CREATE-ID-COUNTER COM.RANDALLSQUARED.COOL::COURSECL- PREVALENCE::NAMECL:EQUALPCL-PREVALENCE::TX-CREATE-OBJECTS-S LOT-INDEX COM.RANDALLSQUARED.COOL::XHTML-PAGECOM.RANDALLSQUARED.COOL::TITLEdefault-page-titleCOM.RANDALLSQUARED.COOL::XHTMLdefault-page-contentCL-PREVALENCE::TX-CREATE-OBJECT COM.RANDALLSQUARED.COOL::CLASSROOMCL-PREVALENCE::TX-CREATE-OBJECT COM.RANDALLSQUARED.COOL::COURSECOM.RANDALLSQUARED.COOL::CLASSROOM21default-page-titledefault-page-contentCOM.RANDALLSQUARED.PSIUSER::HANDLES7875CL-PREVALENCE::NAMEcourseCL- PREVALENCE::TX-CREATE-OBJECT So far, so good, I think. In case it's not clear from the above (it isn't to me), the course has id 3, the classroom id 2, and the xhtml-page id 1, since the default contents get created just before they're passed to tx-create-object in managed-prevalence.lisp. But upon restarting the system, while all the id integers are correct, the xhtml-page isn't attached to the pages hash anymore: * (find-courses) ; a standin for (find-all-objects *system* 'course) (#) T * (get-id (car (find-courses))) 3 * (get-id (classroom (car (find-courses)))) 2 * (pages (classroom (car (find-courses)))) # * (gethash "" (pages (classroom (car (find-courses))))) NIL NIL * (find-object-with-id *system* 'xhtml-page 1) # T So, the obvious question is, how come the hash doesn't get it's xhtml-page back? -- Randall Randall "And no practical definition of freedom would be complete without the freedom to take the consequences. Indeed, it is the freedom upon which all the others are based." - Terry Pratchett, _Going Postal_