An experiment to use aspectJ with scala for property change notification. It's pretty neat that idiomatic scala properties can be observed for changes with almost no changes to the scala source. (It'd be great if this could be done with a scala plugin without requiring aspectJ.) The scala class needs only to add the marker trait Observable. class Model extends Observable { var prop:String = _ } Modifications to the instance will then trigger the aspect, notifying an observer. val model = new Model() m.prop = "whee" Run that and the test observer sees the change and prints: change observed> example.Model@6abf2d5e=>> prop:whee I'm getting more tempted to use aspectJ because it enables such a simple and idiomatic approach to writing model objects that are: * Concise to write * Use the normal idioms for working with mutable scala objects. * Compatible with java libraries, including JPA. The sources are in src. To try it yourself, use this script which runs mvn. ./tryMe ---- (the tryMe script runs maven several times - I had trouble figuring out how to order the exection of the maven plugins within maven itself. Anybody know how to fix this?) -- Note, since this experiment I've also tried using -javaagent to weave at class load time. It seems to work pretty well as an alternative to weaving at compile time. ---- Alternately, you can edit and use the editToTryNoMaven script, which is more understandable but requires manual editing to setup local paths. 1) install aspectj1.6 (I insalled it in /usr/local) 2) edit the editToTryNoMaven script * point at the correct location for the jar files * make sure the script or your $PATH can point to ajc and scalac 4) ./editToTryNoMaven