torsdag, december 06, 2007

AspectJ and JRuby?

This is one of those idea-posts. There is no implementation and no code. But if someone wants to take the idea and do something with it, go ahead.

The gist of it is this: what if you could implement the actions for AspectJ in Ruby? You could define an on-load pointcut that matches everything and dispatches to Ruby. From there on you could do basically anything from the Ruby side - including dynamically changing the stuff happening. Of course, there would be a performance cost, but it could be incredibly useful for debugging, when you don't really want to restart your application and recompile every time you want to change the implementation of the aspect code.

3 kommentarer:

Susan Davis sa...

Even more useful would be the ability to advise the JRuby code, allowing (among other things) already-written AspectJ aspects to be plugged in to a JRuby project, or for JRuby to be used for a portion of a system that has aspects advising the Java part of it.

Dean Wampler sa...

I've also been thinking about the idea of using Ruby to advise Java. I've done a lot of AspectJ coding (Contract4J) and lately AOP in Ruby (Aquarium).

Susan's suggestion would be good, too, as the AspectJ pointcut language is very powerful (much more so than Aquarium's - at least so far ;), so Ruby code running on JRuby could also benefit from AspectJ!

Hopefully I'll have time to pursue these ideas after the holidays!

Dean Wampler sa...

Aquarium 0.4.0 now offers preliminary support for writing Java aspects using JRuby.