From: Duane on
Hi,

I have an application in which I would like to allow anyone to write
"blocks" of code that implement a specific API for processing data on
inputs and pushing data to outputs. The idea is that users would
write their own blocks of code with whatever dependencies they
desire. A "program" would be built out of a series of blocks,
executed by an engine to accomplish a desired processing pipeline.
Because blocks all conform to one API any block can be use in a
pipeline and the resulting pipeline will do something useful if the
user has connected all the inputs and outputs appropriately.

My question is if anyone is aware of a method of dealing with the
library conflicts like "block A uses library B version 1 and block C
uses library B version 3, where versions 1 and 3 of library B have
significant name space conflicts."

In the Java world I could use classloader "fu" to deal with these
issues along the lines of OSGI but I'm not certain about how to deal
with this in the Lisp world, if possible.

Thanks,
-- D.

From: Pascal J. Bourguignon on
Duane <dsearsmith(a)gmail.com> writes:

> Hi,
>
> I have an application in which I would like to allow anyone to write
> "blocks" of code that implement a specific API for processing data on
> inputs and pushing data to outputs. The idea is that users would
> write their own blocks of code with whatever dependencies they
> desire. A "program" would be built out of a series of blocks,
> executed by an engine to accomplish a desired processing pipeline.
> Because blocks all conform to one API any block can be use in a
> pipeline and the resulting pipeline will do something useful if the
> user has connected all the inputs and outputs appropriately.
>
> My question is if anyone is aware of a method of dealing with the
> library conflicts like "block A uses library B version 1 and block C
> uses library B version 3, where versions 1 and 3 of library B have
> significant name space conflicts."
>
> In the Java world I could use classloader "fu" to deal with these
> issues along the lines of OSGI but I'm not certain about how to deal
> with this in the Lisp world, if possible.

You could implement a kind of "class loader" in lisp.

The idea is to load the libraries, and the delete the packages they
define. Then when you load another version of the libraries, they won't
override the definitions of the first version.

The only remaining problem is that lisp libraries could modify global
resources, which is harder to track and deal with. But if the libraries
are well encapsulated in their packages, that will work.


--
__Pascal Bourguignon__
From: Thomas A. Russ on
pjb(a)informatimago.com (Pascal J. Bourguignon) writes:

> The idea is to load the libraries, and the delete the packages they
> define. Then when you load another version of the libraries, they won't
> override the definitions of the first version.

I thought about a similar approach but using the slightly less drastic
approach of just renaming the library packages.

Another solution would be to run each code block in a separate process
and use a stream or file-based approach to handle the communication
between the blocks.

--
Thomas A. Russ, USC/Information Sciences Institute
From: Duane on
Thanks, Thomas and Pascal.

You have helped me to believe that I wasn't missing anything obvious.
Your feedback has been helpful.

Best,
-- D.
From: refun on
In article <8bf3a0f5-fef5-48af-81be-a4a1666ea100(a)15g2000yqi.googlegroups.com>,
dsearsmith(a)gmail.com says...
>
> Hi,
>
> I have an application in which I would like to allow anyone to write
> "blocks" of code that implement a specific API for processing data on
> inputs and pushing data to outputs. The idea is that users would
> write their own blocks of code with whatever dependencies they
> desire. A "program" would be built out of a series of blocks,
> executed by an engine to accomplish a desired processing pipeline.
> Because blocks all conform to one API any block can be use in a
> pipeline and the resulting pipeline will do something useful if the
> user has connected all the inputs and outputs appropriately.
>
> My question is if anyone is aware of a method of dealing with the
> library conflicts like "block A uses library B version 1 and block C
> uses library B version 3, where versions 1 and 3 of library B have
> significant name space conflicts."
>
> In the Java world I could use classloader "fu" to deal with these
> issues along the lines of OSGI but I'm not certain about how to deal
> with this in the Lisp world, if possible.
>
> Thanks,
> -- D.

Maybe a possible solution would be to extend/modify your favorite defsystem
facility such as ASDF to support an unload-op (it has a load-op, but I'm not
aware of it having an unload-op). The default behaviour should be something
similar to Pascal's solution of deleting packages, but the user could add an
:after method combination if they wanted to uninstall some handlers or perform
other global cleanup. This approach would be similar to how shared
libraries/dynamicly loadable libraries in various platforms work: they receive
a message somehow to load or unload their code, which gives them an opportunity
to perform cleanup. Such cleanup may be less important in CL as there is a GC,
but deleting packages and uninstalling some possibly globally registered
handlers/hooks would be necessary.