[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Packages vs ML functors



I would like to hack a similar feature to ML's functors, e.g. functions that
create packages. Here's the general idea:

 (make-package "queue1")...queue1 code
 (make-package "queue2")...queue2 code

 (deffunctor "app" (queuePackage))

 (in-package "app") ..app code

 (setq app1 (app queue1))   ; app1 now a package
 (setq app2 (app queue2))   ; app2 now a package

I want (as in ML) app1 and app2 to share all the app code, but use different
queue packages. I know this trivial example is simple with CLOS, but imagine a
more complex example where the packages have non-trivial class hierarchies that
conflict.

 Any thoughts? It seems hard to me, but what do I know.  One solution would be
to just copy the whole package, like an ADA generic, but I would rather share
code. 

Jim Hurd