Re: CLSQL changes object behaviour

Marcus Pearce <[email protected]>
Newsgroups gmane.lisp.clsql.devel
Message-ID <[email protected]>
Hi Edi,

> I use various CLOS and MOP techniques to "automate" the behaviour of
> my objects. One of them is to use an :AFTER method for
> INITIALIZE-INSTANCE to do various things once the object has been
> created. These methods expect the objects to be fully set up when they
> are called - they are always created with MAKE-INSTANCE and
> appropriate initargs. This is not always the case with CLSQL, however:
> If the object is created by a call to SELECT (i.e. if it comes out of
> the DB) it is obviously created by a "naked" call to MAKE-INSTANCE and
> filled with calls to (SEFT SLOT-VALUE) afterwards. So my :AFTER
> methods cease to work... :(

It just occurred to me that you might be able to resolve this problem by
(ab)using the CommonSQL compatible INSTANCE-REFRESHED hook. An
INSTANCE-REFRESHED method specialised on your chosen View Classes (and
containing code analagous to that in your :after methods for
INITIALIZE-INSTANCE) will be invoked on the newly created objects (with
slots already filled) returned by a call to SELECT with :REFRESH t. From
what you say, it sounds as though you'd want to be doing this anyway.

Cheers,
Marcus
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.