This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: setf.scm


>>>>> "Per" == Per Bothner <bothner@cygnus.com> writes:

Per> But with single dispatch you don't "add a new method to a class object".
Per> You add a new class *with its associated method table*.  The new class
Per> does not change any old method tables.

Ok, the part with "adding methods" was based on the traditional CLOS
way of doing things, and one can of course do the adding as part of
the class definition as well, but I think the basic argument still
holds, that there are no fundamental differences (for some appropriate
definition of "fundamental" :-) wrt. to changes between the two views.

Suppose you have a class hierarchy and a generic function. With the gf
there is (conceptually) an associated table mapping classes to
methods. In CLOS, this table is stored directly as part of the gf, in
the class-oriented view, the table is (again conceptually) distributed
across the class hierarchy, storing bits of the table in each class
having a method for the gf.

However the table is stored, in order to understand the generic
function one needs to know the *effective* method dispatch table,
whether it is stored in one object or has to be collected from pieces
stored in each class.

When a class is a added to the system, together with a method for our
generic function gf, its effective method table is changed, although
implicitly.


---------------------------+--------------------------------------------------
Christian Lynbech          | Telebit Communications A/S                       
Fax:   +45 8628 8186       | Fabrik 11, DK-8260 Viby J
Phone: +45 8628 8177 + 28  | email: chl@tbit.dk --- URL: http://www.telebit.dk
---------------------------+--------------------------------------------------
Hit the philistines three times over the head with the Elisp reference manual.
                                        - petonic@hal.com (Michael A. Petonic)