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 (!)


Marius Vollmer <mvo@zagadka.ping.de> writes:

> Actually, merging of generic functions might turn out to be a often
> wanted thing, and we might want to provide a convenient syntax to
> request it.  But I don't want this generic merging to happen _without_
> this explicit request from the user.

Unless someone is able to explain why he needs to merge
generics (and what that means!) I say that guile neither needs
a) more than one generic with the same name nor b) does it require
some elaborate system which tries to merge them.

The module system doesn't care about names, it cares about locations.
Thus the tupel [module-name, method-name, specializers] is 
(bound to a location and this location is) globally unique.

It is true that it is necessary to rename a imported symbol.  But this
is a standard problem connected with multiple inheritance and has been
solved since 1880 or so: Either use the class precedence list (the
module's import list that is) or rename features while inheriting
(importing) them.


An example:

(define-module (M1))
(export (a mutable-location))
(define a 1)

(define-module (M2))
(export (a immutable-location (alias M2:a)))
(define a 2)

(define-module (M12) :use-module(M1) :use-module(M2))
a -> 1
M2:a -> 2
(module-open (M2) (M1))
a -> 2
(set! a 99) -> error immutable location


BTW: MZScheme has a nice way to avoid these problems.  It also
has a nice object system.. :)

Jost

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