Tuesday, December 9, 2008

What is Eclipse?

When you think of Eclipse (I will refer to it as eclipse) you probably think of a large, corporate java editing platform. This is what it has become but it isn't what it is at its heart.

The core piece of eclipse is a plugin framework. This is the extent of my eclipse knowledge.

Given nothing else, eclipse is a system for managing plugins. Plugins can publish interfaces and 'extension points' (whatever that is) and they can state what interfaces they require for correct operation. They do this in an xml file, so Eclipse can delay-load everything based on a large plugin xml database.

The end goal of this project is to enable a live-coding environment in eclipse that is editing the eclipse application it is running in. I will attempt to do this using clojure but I don't actually know how possible this really is. It should be possible and if I am successful it would be a darn cool way to specialize the editing platform.

First off, I want to really understand what eclipse is. What datastructures are involved and how do you talk to them. I will want to understand what eclipse needs for various types of plugins and I will attempt to ascertain how amenable the system is to live-updating while it is running.

All I really need to do is figure out how I can build an eclipse plugin in clojure, however. There is a clojure plugin for eclipse already that is written in java but I will be god damned before I spend my free time working in java. I did that once and it took months of studying pure math for me to undo the dumness. I was awash in waves of dumnity and I almost drownded.

I am just going to study things like I usually do and update this blog as I study.   I am currently downloading the eclipse framework.  I already downloaded clojure and have no idea how to do anything with it but the repl.  Perhaps I can extend eclipse using the repl?  Is there (load-file "blah") functionality?  REPLs are nice, but typing things once is nicer.


Gotta start somewhere....

Opening the eclipse I was downloading. It is missing the "What the fuck are you?" button.

Reading the manual about the workspace, it appears that there is a small runtime kernel and a workspace on top of that. Where is the definition of the runtime component?

One thing going through my mind is 1. how ugly the interface is and 2. how slow it is to update. This isn't ideal; there really shouldn't be noticeable time between moving a window and seeing it change. I have been worried about this before and thus using the eclipse plugin framework with the QT UI framework definitely has come to mind.

Another thing I don't like about eclipse as it stands as it has moved some substantial project management functionality into its UI. These things seem orthogonal concepts to me...

perhaps a little closer:
http://www.eclipse.org/equinox/

Downloaded the osgi specification. I know this is overkill but I gotta. I hate it when you have to register for things to get them btw. It is a fucking spec, it is in everyone's interest for it to become common knowledge...

--"This aspect of the
Framework makes an installed bundle extensible after deployment: new
bundles can be installed for added features or existing bundles can be modi-
fied and updated without requiring the system to be restarted--"

This would seem to be the key enabler for a live-coding environment...

OK, reading a bunch about this stuff is interesting and I guess now it is time to start taking a bunch of other steps.

Overall, the OSGi system is an entire execution environment. Whereas when you compile a basic java program you get access to all of the java libraries you have referenced from your jar file, an OSGi bundle has access to libraries that it has declared it needed through a set of constraints.

So the classloader is specialized depending on your bundle specification and the existence of other bundles in the system. The environment takes care of things like loading two different versions of the same object, unloading and reloading shit and various other details.

What I was thinking was a lot lower level. If I implement stuff in clojure such that any interface I give to eclipse has a pointer to an implementation then I could conceivably just update the implementation pointer when I load the new file. Assuming I can find the interface I handed back to eclipse but I would assume in a forever-running runtime this should be possible. This would work regardless of OSGi nonsense, but at least there is one less term I have to filter out due to lack of information.

Next up I get some basic clojure editing working with my aquamacs emacs system. I got stuck earlier on classpath issues, but I need to read a lot more clojure editing environment tutorials. I am not certain what classpath means on a mac but I couldn't find a classpath environment variable....

Chris

No comments: