[Prev][Next][Index][Thread]

Re: [FD] creating classes at runtime



On Wed, 10 May 2000, Scott McKay wrote:
> You're on the right track.  There are at least two problems here, though:
>  (1) By default, classes are sealed.  That is, <animal> is sealed, so you
>      can't create any subclasses.  Define <animal> with 'define open class'.
>  (2) I bet 'superclasses:' needs a sequence, not a single class.
> 
> I didn't try it, but those two changes will get you farther.

Oddly enough, the DRM sez it can take a <class> or a <sequence> of
classes, so presumably it's just the sealing that's the problem (or a bug
in make(<class>, ...)!).

BTW, the slots you put in a dynamically-created class can given a "type:"
*or* a "deferred-type:".  In the latter case, the expression for the
slot's type isn't evaluated until within the first call fto make for that
class.  Anyone know/think of a use for this?!?

> dauclair@hotmail.com wrote in message <8fakp2$pqg$1@nnrp1.deja.com>...
> >The DRM is a little vague on how to do this, but I'm looking to do
> >something like this:
> >
> >
> >// ---- code ----
> >define class <animal> (<object>) end; // predefined
> >
> >// sometime later, the user wants to add a class
> >// (by, e.g., supplying characteristics thru DUIM)
> >define constant <mammal> = make(<class>, superclasses: <animal>);
> >// ---- end-code ----

Hugh




Follow-Ups: References: