This is the mail archive of the guile@sourceware.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: Trouble understanding define (!)



Hi,

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?

I have problems with the sentence "depending on what kind of pack the
cards have".  What does this mean?


> 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.  I you want a strong method---class coupling,
you canīt use GFīs anyway: You canīt force a user who creates Mī from
M to also create drawī.


Jost

PS: An alternative for selective export would be "parametric modules", IMHO.

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