9

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?

4
  • 1
    Way cool, related article Dynamic Applications From the Ground Up citeseerx.ist.psu.edu/viewdoc/… on making Haskell's Yi editor "dynamic" from the ground up. Commented Apr 3, 2012 at 3:17
  • Are you talking about implementing OSGi within a single Haskell application or about exposing & consuming Distributed OSGi uServices to other OSGi instances?
    – oconnor0
    Commented Apr 10, 2012 at 19:05
  • 1
    I think that would be part of the answer: it would explore the different ways this could be done, or what it would mean, along with pluses and minuses of each. Commented Apr 10, 2012 at 19:21
  • Since OSGi is a JVM platform, you may want to take a look at jaskell.codehaus.org Commented Apr 15, 2012 at 16:36

1 Answer 1

1

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.

2
  • Great tip on the Java Plugin Framework - I didn't know about it! Looks like a great little lib for my future projects where OSGi is not permitted. Commented Apr 19, 2012 at 13:09
  • The coolest aspect of OSGi (the parts that decouples most) are the services. JPF is about half the size of Apache Felix OSGi framework but for those additional bytes you get a formal standard, side by side versioning, a growing eco system AND services. Commented Mar 14, 2013 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.