guile-devel
[Top][All Lists]
Advanced

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

Re: Making every goops object applicable


From: Neil Jerram
Subject: Re: Making every goops object applicable
Date: Tue, 15 May 2012 21:43:00 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)

Mark H Weaver <address@hidden> writes:

> Krister Svanlund <address@hidden> writes:
>> For example an instance of a class inheriting a class that inherits
>> <applicable-struct> that defines 'procedure is not applicable.
>
> Looking at the code, it is clear that in order for a GOOPS instance to
> be applicable, it is not enough for <applicable-struct> to be a
> superclass.  It is also necessary for the _metaclass_ of its class to
> have the SCM_VTABLE_FLAG_APPLICABLE_VTABLE bit set.
>
> One such metaclass is already built-in: <applicable-struct-class>, which
> is the metaclass for <applicable-struct>,

So the solution to Krister's problem is to make sure that every class
he's interested in is defined as

  (define-class <whatnot> (supers...)
    ...
    #:metaclass <applicable-struct-class>)

Right?

> but if you'd like to define
> your own metaclass for applicable objects, you can set the bit manually
> on the metaclass as described by Ludovic.

Would this be needed, if the above works?

> However, keep in mind that the presence of that bit in the metaclass
> indicates that the first slot of all instances _must_ be the procedure
> slot.

Might the (define-class ... #:metaclass <applicable-struct-class>)
ensure that, by some kind of of compute-slots customisation...?  I took
a look but unfortunately couldn't see this in the code.

       Neil





reply via email to

[Prev in Thread] Current Thread [Next in Thread]