[Openmcl-devel] Applying sequence functions to a new type
rm at fabula.de
rm at fabula.de
Tue Mar 1 14:34:48 UTC 2005
On Tue, Mar 01, 2005 at 05:52:41AM -0700, Gary Byers wrote:
> On Mon, 28 Feb 2005, Andrew P. Lentvorski, Jr. wrote:
> > This is probably a really stupid question, but how do I define the
> > sequence functions so that they apply to a new class?
> You basically can't reliably subclass BUILT-IN-CLASSes like SEQUENCE
> (or FLOAT or FIXNUM) in CLOS.
Is this a limitation of CLOS or an artefact of the implementation of BUILT-
> The standard sequence functions are not necessarily GENERIC-FUNCTIONs
> (they aren't in OpenMCL or in any other implementation I'm aware of),
> so you can't extend their behavior by adding methods on them.
But that at least is open to the implementation - it _would_ be possible
to have the sequence functions as GENERIC-FUNCTIONs.
> There are object systems (I believe that this is true to a large
> degree of SmallTalk) in which there's no concept of a non-extensible
> BUILT-IN-CLASS and in which all functions are (conceptually, at least)
> something like GENERIC-FUNCTIONs, but CLOS is not such a system.
AFAIK it's possible to do so in guile's GOOPS (which is rather close
to CLOS :-) by doing:
So one can enable GENERIC-FUNCTIONality per build-in function. Off course
it's more expensive to change a build-in into a generic but since one can
do so for individual functions there's a lot of control.
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
More information about the Openmcl-devel