This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: Trouble understanding define (!)
- To: Jost Boekemeier <jostobfe at calvados dot zrz dot TU-Berlin dot DE>
- Subject: Re: Trouble understanding define (!)
- From: Mikael Djurfeldt <mdj at mdj dot nada dot kth dot se>
- Date: 02 Feb 2000 12:31:08 +0100
- Cc: Michael Livshin <mlivshin at bigfoot dot com>, Neil Jerram <neil at ossau dot uklinux dot net>, guile at sourceware dot cygnus dot com, djurfeldt at nada dot kth dot se
- Cc: djurfeldt at nada dot kth dot se
- References: <200001142054.UAA00622@ossau> <p2tzou4o5ov.fsf@pampelmuse.zrz.tu-berlin.de> <200001182250.WAA00624@ossau> <xy7ya9nezzz.fsf@mdj.nada.kth.se> <200001221200.MAA00478@ossau> <xy7bt6e82ru.fsf@mdj.nada.kth.se> <s3zotxrqoz.fsf@verisity.com> <xy7iu0cbc1z.fsf@mdj.nada.kth.se> <s3iu0bq1x5.fsf@verisity.com> <xy71z6z35os.fsf@mdj.nada.kth.se> <s33drfpm9d.fsf@verisity.com> <xy73drec8ap.fsf@mdj.nada.kth.se> <p2t66w7j24a.fsf@guave.zrz.tu-berlin.de>
Jost Boekemeier <jostobfe@calvados.zrz.TU-Berlin.DE> writes:
> I donīt understand this part:
>
> > The problem, as I see it, is that it is uncomfortable for the user to
> > manage the question of which GFs of the same name really should be
> > represented as one GF.
> >
> > We might have one graphics library which provides a set of methods for
> > the GF `draw'. Then we might use this in a Poker game where we have a
> > GF `draw' which draws cards in different ways depending on what kind
> > of pack of cards we have.
>
>
> You have a module "draw" which exports several names:
> draw<int>...
> draw<grapics><line>...
> draw<grapics><point>...
> draw<cards><field>...
> draw<cards><card>...
>
> If draw<cards>... should only visible to client module "game", just do
> a selective export and youīre done. Or do I miss something important?
The modules are "graphics" and "cards". The name being exported is
"draw".
> I have problems with the sentence "depending on what kind of pack the
> cards have". What does this mean?
"different ways" means different methods.
"kind of pack" means class of pack (there are different subclasses of
<cardpack>).
> > It is clear that these two GFs represent different concepts, and one
> > way of handling the situation in the module system is to import with
> > renaming: g:draw, card:draw.
>
> In Clos generic functions donīt represent different concepts as they
> donīt belong to classes.
A generic function represents the concept of a certain action, such as
the action of "drawing a figure" and the action of "drawing a card".
> PS: An alternative for selective export would be "parametric modules", IMHO.
My impression is that parametric modules are used to re-use code, so
that one module "template" can be instantiated in many ways depending
on the parameter, for example a phone register using any of a number
of database implementations. I don't see how this could help us here.