Generic functions
Frank DiCostanzo
frdF93@hamp.hampshire.edu
Fri, 21 Jul 1995 03:08:20 -0400 (EDT)
i wrote:
> > I agree with you completely that the foundation for a distributed object
> > system should be based on a message passing system of some sort. Generic
> > functions have the problem that they aren't "sent" anywhere so who does
> > the computation? who "owns" the gf?
>
On Fri, 21 Jul 1995, Patrick Premont wrote:
> A generic function is a first-class object, it doesn't have to be
> "owned" by any of the objects. Who does the computation ? You can
> choose the scheme you want :
>
[variety of process management schemes deleted]
that wasn't exactly what i had in mind. remember that i agree with you
that gf are way spiffy and should be included in any object system.
originally, i was all for them as a basic core, until i started looking into
truly distributed systems. thats were they start to break down.
lets say there is a really nifty object 'foo' which has a set of behaviors
about it. lets say its located on some computer far, far away in the
backwaters on the other side of the planet, in say... France. (hey, i'm in
Alaska)
so i write some program that needs foo and i tell it where it is.
it requests foo from France, and the object is packaged up and sent over
here to Alaska. now if i am using message passing, i know precisely what
methods need to be sent with foo and these can be packaged up and sent
along with it. thats because the message is associate WITH foo directly.
i can ask foo "so, what behaviors do you support?" and it can give me a
list. it is in one nice cohesive package with definable barriers.
however, if i am not using message passing but using methods
all-the-way-down then it isn't quite so easy to move all the behaviors i
need with foo. i need to query the entire French system asking around if any
generic function has some method which might effect foo. thats not just
methods with 'foo-type' as a type but any superclass of foo or whatever.
that could be a hellovalot of methods which need to be extracted from
quite a few gf. but i do that, and send them over to my system. now, in
order to use them, i need to modify my entire system by adding these
methods into my generic functions. not all of them are specialized just
on foo, but may be speciallized on some of foo's superclasses. these
methods may start effecting my classes in unexpected ways. if i need to
load objects from all over the place, i'm going to start getting a mess
of conflicts.
and this is not just from moving objects around the world. how many
people here have tried to install a large CLOS program _without_ using
the package system. its a nightmare, and packages aren't much help
> I still think generic functions are better than message
> passing. (it gives cheap generality, modularity and reflexion)
for high level control and object interaction i agree. i've thought up
some ideas on how the above problem would not be quite an issue at higher
levels of abstraction. but at low levels, its gotta be message passing.
Frank
Binkys Dead. Long Live Binky.