Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Haskell implement OSGi?

Tags:

haskell

osgi

My question, is triggered by a post by Peter Kriens: What If OSGi Ran Your Favorite Language?

So, is it possible for Haskell to implement the OSGi specifications? If not, why?

like image 512
Andriy Drozdyuk Avatar asked Mar 13 '12 14:03

Andriy Drozdyuk


1 Answers

I guess you are asking whether there could be an OSGi for Haskell (question 1), rather than whether Haskell could be used to implement the OSGi specification (question 2).

About 1: I don't think it is possible without putting up several layers of indirection. The most important language feature necessary to implement OSGi for a programming language is dynamic loading and unloading of modules at run-time. Now, OSGi - in a simple way - is a clever way to use Java class loaders to achieve this, while the developer of code does not notice it, but continues to use "import com.mypackage...".

I don't know sufficient Haskell, but I doubt Haskell has the hook-points for an external library to get inside the Haskell interpreter so that loading modules can be intercepted and dynamically rerouted to another haskell file.

About 2: If you are willing to compromise the language support, but are fine with loading modules by string literals, then implementing the core ideas of OSGi and using it in Haskell will be a nice little project.

My favorite implementation of a plugin-framework (close to OSGi in spirit) is the Java Plugin Framework. Less code, than one might expect.

like image 64
Christopher Oezbek Avatar answered Nov 09 '22 01:11

Christopher Oezbek