jastrachan | 2 Apr 09:24 2004

Re: Some late thoughts on optionality...

On 1 Apr 2004, at 16:15, Mikael Forslund wrote:
> Jon tirsen wrote:
> >>Yes, sometimes one actually *wants* to write write-only code, say an
> >>automatic script that cleans up something on your harddrive, or
> >>whatever. This is something you cannot do in Java, which is actually
> >>quite limiting. Java does certainly need such a language.
> >>The great thing with Ruby (and hopefully Groovy will end up this way
> >>too) is that you can write any type of code depending on your
> >>situation.
> I agree but what about all those lines of write-only code that you 
> wrote 6 months ago and you now wanna reuse J

Hopefully even if someone writes write-only code in Groovy it won't be 
*that* hard to understand.

> >>I did some thought-experimentation on how to implement dynamic AOP in
> >>Groovy (something like Ceaser/J, but with more stuff happening at
> >>runtime). It's actually quite simple and only requires one single 
> hook
> >>into the Groovy runtime, a *global* (I know there are local ones) 
> hook
> >>that gets called around all method calls and all field reads/writes.
> >>Performance? Nah... If you're out for pure performance maybe Groovy
> >>isn't the language to start with.
> >>Transparent persistence is quite easy to implement once you got AOP.
> Nice one. Yeah I for one like the idea of using attributes to define 
> aspects and advices but putting the pointcut definitions externally 
> (XML file maybe…). That should give a good balance between AOP and AOP 
> (meta-data and meta-behavior).

Incidentally have you seen Thomas's work on GAP?


Basically using Groovy + AOP + Pico, in particular using dynaop though 
it'd work with any of the AOP frameworks. The idea was to use 
GroovyMarkup to define the various trees of containers of components, 
introduce advice and use closures to define the pointcuts.


classPointcut =  { it.package.startsWith("com.acme.model") && 
it.implements(Cheese.class) && it.annotation("Transactional") }

> I guess that ASM takes care of the byte-code optimization (hmm, is ASM 
> speedier than CGLIB2?).

I thought CGLIB2 used ASM - i.e. its a layer above it.