Hi Brent, Brent Pinkney <b...@4dst.com> writes: > I am having serious problems exporting generics from subclasses of > <object> and then using them in other modules.
Apologies for the confusion. You're not the only one who's been having trouble with this. There *is* a proper solution, which I will describe below, but clearly this issue needs to be discussed in the manual, and we should probably add some compiler warnings as well. The root of the problem is that GOOPS automatically defines generic functions whenever you add a method to a generic that does not exist. IMO, this was a serious design error, made many years ago. It was done in the name of convenience, but has caused enormous confusion over the years. It is best to *never* rely on this automatic behavior. The proper solution is as follows: * Every generic function must be defined (using 'define-generic') and exported from one (and only one) module. * Every module that uses a generic function, or adds a method to it (and that includes slot accessors), must first import the generic function from the (one) module that exports it. Think of a generic function as a normal procedure that contains an internal table of methods. Like any other procedure, there's a single module that defines it and exports it. The fact that some modules add methods to these internal tables does not mean that it is appropriate to export the procedure from those other modules. Hope this helps, Mark