[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [aspectj-users] AspectJ + Scala
- From: robert kuzelj <robert_kuzelj@xxxxxxxxx>
- Date: Thu, 10 Aug 2006 15:57:42 +0200
- Delivered-to: firstname.lastname@example.org
- User-agent: Thunderbird 220.127.116.11 (X11/20060615)
> Does anyone have any experience using AspectJ in conjuction with Scala,
> particularly for writing Eclipse plugins?
> I am doing some EMF extension development;
> I have already found AspectJ to be more or less essential for this
> There are, however, things that would be more natural in something like
> I would like to use both, but I am concerned how they will play together.
> Clearly AspectJ can't compile Scala source,
> but it should be possible to use the generated class files.
> Has anyone actually done this?
as aspectj supports bytecode weaving you could do this.
alas there is a big hurdle when doing the same with scala.
aspectj works very closely on the semantics of the java
language. the java language and the bytecode representation
are very much aligned.
as scala is conceptually far richer than java,
the scala compiler must jump thru quite some loops
to represent those concepts on a bytecode level.
for example scala knows closures and compiles those
closures to inner classes on the bytecode level, also scala
creates multiple bytecode classes for one "scala class".
just call javap on some scalac generated classes and you
so in the end if you wanted to use aspectj in conjunction with
scala you would have to mentally transform
scala -> bytecode -> java in order to know how to
write your pointcuts and advices for your scala code.
additionally you would have to hope that the
scala-compiler-team does not change the compiler in
such a way that the generated bytecode differs between
2 scalac releases.
in the end what you want is possible but i would strongly
advise against it. a better way would certainly be to subscribe
onto the scala mailing lists and convince the powers there
to offer some AOP hooks into scala.
> Are there any known issues with this?
> I am also interested in people's experiences
> using AspectJ with other non-java JVM languages.
> aspectj-users mailing list