Indeed! This was handled on the elephant-unstable development branch
by fixing some bugs in the update-instance-for-redefined-class behavior.
Darcs elephant-unstable will replace the main elephant branch in a few
weeks when my schedule allows. I've been keeping up with the patches
for the most part - but unstable required significant refactoring to
support class schemas and schema evolution so the patches often have
to be applied manually. The benefit, I believe, will be a much easier
to use and more stable solution. It also has a number of new features
which I've documented in earlier e-mails.
In the process of refactoring I found, and wrote tests for, quite a
few bugs that I'm amazed were not caught earlier.
Ian
On Apr 3, 2008, at 9:23 AM, [EMAIL PROTECTED] wrote:
Leslie P. Polzer writes:
(defclass pineapple () ()
(:metaclass persistent-metaclass))
(let ((fruit (make-instance 'pineapple)))
(defclass pineapple ()
((tree :initform 1))
(:metaclass persistent-metaclass))
(slot-value fruit 'tree)))
Will raise unbound slot hell with current code if you have
a lot of instances. Backends signal UNBOUND-SLOT instead
of calling SLOT-UNBOUND (which is the more conformant option
as I see it from CLHS and the MOP spec).
This is also better "do what I mean" behaviour; normally
when you provide an initform for a slot you rely on never
having to deal with unbound slots (at least I do).
Attached is a patch which tests this, changes the backend behaviour
and provides a default for SLOT-UNBOUND that uses the initform
to fill in the slot value.
This is probably bad: you can't SLOT-MAKUNBOUND anymore. I have not
yet read and understood all about CLHS 4.3.6.2 but something along
UPDATE-INSTANCE-FOR-REDEFINED-CLASS looks like what's needed.
I can't test it here but the test would look like:
(deftest slot-unbound
(progn
(defclass pineapple () ()
(:metaclass persistent-metaclass))
(let ((fruit (make-instance 'pineapple)))
(defclass pineapple ()
((tree :initform 1))
(:metaclass persistent-metaclass))
(values (slot-value fruit 'tree)
(progn (slot-makunbound fruit 'tree)
(signals-specific-condition (unbound-slot)
(slot-value inst 'slot1))))))
1 t)
_______________________________________________
elephant-devel site list
elephant-devel@common-lisp.net
http://common-lisp.net/mailman/listinfo/elephant-devel
_______________________________________________
elephant-devel site list
elephant-devel@common-lisp.net
http://common-lisp.net/mailman/listinfo/elephant-devel