[aosd-discuss] [aopalliance-discuss] A new tool for efficient annotation processing in Java 5.

Daniel Lohmann Daniel.Lohmann at informatik.uni-erlangen.de
Wed Feb 8 11:31:12 EST 2006


Renaud Pawlak wrote:
> [...]
> 
> ... because I did not really explained the Spoon templates... let me fix 
> it!
> 
> Spoon provides a pure Java template mechanism that is close to the C++ 
> one. That's actually the main topic of our research (Java templates). 
> Spoon-AOP is just a cool application I wanted to point out for this 
> mailing list. Anyway, Spoon templates, even though they use Generics, 
> are *not* generics in the Java 5 sense. They go far beyond them (Java 5 
> generics are very different from C++ and are used mainly for type 
> safety). Of course, since nothing is magic, Spoon templates require the 
> use of compile-time reflection (that you can see as a kind of well-typed 
> and well-structured pre-processing). This is implemented by the Spoon 
> Open Compiler.
> 
Okay, I see.

> I took a look at your cache example [1]. I of course intend to study it 
> more (and also read the rest of your papers carefully)! However, at 
> first sight, it seems that Spoon-AOP can do what you do with C++ 
> template. I have hard time reading C++ though (especially mixed up with 
> templates!) It would help if you had a pointer that tells me how the 
> final code looks like for typical case(s) (I can guess how the final 
> code looks like for the non-templated aspect version). 

What do you mean by "tells me how the final code looks like". I assume 
you do not want to have the machinery code... The instantiated 
templates? Unfortunately that is not possible. All C++ compilers I am 
aware of do not provide an explicit representation of them, but 
transform templates directly into machinery code.


 > BTW, is it
> correct to say that the point of the templated version is to be able to 
> work efficiently on an arbitrary number of arguments?

Yes. Arbitrary number of arguments of arbitrary (copy-constructable and 
comparable) types. In short: arbitrary function signatures.

> Anyway, if you are interested in our Java templates, I recommend you to 
> take a look at Spoon. I am very interested in your feedback on them. We 
> need a comparison between our Java templates and C++ templates that we 
> did not do yet for time (and lack of competence) reasons.
> [...]

On the long term I would strongly recommend you to gain some competence 
in C++ templates. Especially people from the meta-programming community 
will ask you to compare your approach against it. Moreover, tons of 
papers and books have been written about generic/generative programming 
using C++ templates. Porting exisiting and accepted 
examples/applications to Spoon while discussing the benefits, drawbacks 
and unique features of it might help a lot to sell your stuff :-)


> So, what I think is that our templates are an interesting way of doing 
> generative programming in Java. They are, as I understand, quite 
> different from C++ templates, but offer a real facility for 
> meta-programming (which is not the case of Java 5 generics). As I said, 
> I would really like to have your opinion and comments about this.
> Regarding Spoon-AOP, well I still have a lot of work to do on it, but 
> I'll try to implement your examples with it (when I'll have all I need 
> in Spoon-AOP). I'd really appreciate your feedback once I'll have 
> implemented them.

Reimplementing the generative caching example in Spoon-AOP might be an 
interesting test, especially as it would be possible to compare the 
outcoming numbers with the C++ and the AspectJ versions.

Regarding aspects and genericity you might also want to take a look at 
the LogicAJ stuff of Tobias Rho and Günter Kniesel 
(http://roots.iai.uni-bonn.de/research/logicaj/), which is more 
Java-related.


Daniel








More information about the discuss mailing list