From: Leonid Slobodov
Subject: AMOP example
Date: 
Message-ID: <44b3a042$0$26263$9b4e6d93@newsread2.arcor-online.net>
Since I couldn't get my email through to sbcl-devel or sbcl-help, I'll
try this newsgroup and hope this isn't entirely OT.

I have read AMOP a few weeks ago (a really wonderful experience) and
noticed this example on p.67-69 that talks about the functions
make-programmatic-instance and make-programmatic-class.

These are used to create new classes at runtime and are a
very useful and neat trick to have. 

The examples work perfectly in openmcl and clisp. In sbcl the call
to (make-instance 'standard-class :name <some-list> ...) sadly
errors when calling (setf find-class) on this list ,which is certainly
an understandable thing. What is not clear for me is why (setf find-class)
gets called in the first place, since I thought that this should only
be done in ensure-class, which doesn't get called here.

I don't have enough knowledge about the inner workings of PCL and am
probably not qualified to do any changes (I learned this after trying
to change update-class and screwing up the entire CLOS machinery;
strangely, afterwards this example worked. But the rest didn't :-).

I would like to know whether there is some rationale and whether this can be
fixed before I use a workaround.

PS: I know that most of what I'm decribing here isn't portable, but this
isn't a my primary concern right now and I can use closer-mop later on
if this issue is fixed. 

Happy hacking.

From: Pascal Costanza
Subject: Re: AMOP example
Date: 
Message-ID: <4hhngpF1q65h1U1@individual.net>
Leonid Slobodov wrote:
> Since I couldn't get my email through to sbcl-devel or sbcl-help, I'll
> try this newsgroup and hope this isn't entirely OT.
> 
> I have read AMOP a few weeks ago (a really wonderful experience) and
> noticed this example on p.67-69 that talks about the functions
> make-programmatic-instance and make-programmatic-class.
> 
> These are used to create new classes at runtime and are a
> very useful and neat trick to have. 
> 
> The examples work perfectly in openmcl and clisp. In sbcl the call
> to (make-instance 'standard-class :name <some-list> ...) sadly
> errors when calling (setf find-class) on this list ,which is certainly
> an understandable thing. What is not clear for me is why (setf find-class)
> gets called in the first place, since I thought that this should only
> be done in ensure-class, which doesn't get called here.

It's a bug in SBCL, as well as in CMUCL. I guess that GCL is probably 
also affected.

> I don't have enough knowledge about the inner workings of PCL and am
> probably not qualified to do any changes (I learned this after trying
> to change update-class and screwing up the entire CLOS machinery;
> strangely, afterwards this example worked. But the rest didn't :-).

Yes, this probably requires some careful understanding of PCL internals.

> I would like to know whether there is some rationale and whether this can be
> fixed before I use a workaround.
> 
> PS: I know that most of what I'm decribing here isn't portable, but this
> isn't a my primary concern right now and I can use closer-mop later on
> if this issue is fixed. 

Closer-mop doesn't fix this either. The only workaround at the moment is 
to use a different CL implementation.


Pascal

-- 
3rd European Lisp Workshop
July 3 - Nantes, France - co-located with ECOOP 2006
http://lisp-ecoop06.bknr.net/
From: Christophe Rhodes
Subject: Re: AMOP example
Date: 
Message-ID: <sqvepw8l8z.fsf@cam.ac.uk>
Leonid Slobodov <······@thedoghousemail.com> writes:

> Since I couldn't get my email through to sbcl-devel or sbcl-help, I'll
> try this newsgroup and hope this isn't entirely OT.

(I wonder why you couldn't get through to the sbcl mailing lists, as
they are open to non-subscribers.)

> I would like to know whether there is some rationale and whether
> this can be fixed before I use a workaround.

It was a bug.  I believe I've now fixed it, in sbcl-0.9.14.21, but
fixing it involved quite a lot of rearrangement, and while I think
there isn't anything obvious left unfixed it's still possible that
I've broken something in the meantime (so if you use the MOP and can
spare the time, testing this development version would be
appreciated.)

Christophe