[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[aspectj-users] Re: AspectJ + Scala
- From: "Daniel Mahler" <dmahler@xxxxxxxxx>
- Date: Thu, 10 Aug 2006 16:10:34 +0100
- Delivered-to: firstname.lastname@example.org
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=cA/rgttqDtGaRRx9dj3wlxbkObj09YJvr20Q4SKqigS8XvzdgNHfg6pwuvBTp5lx+wpH2ohQeNlzxnLs49P8AKH/Aw+Lf97CrnkvVvm3BRQGZz3jZ551qO7RlbBIs0U/2TO5BukhgJ+LxXo24VZPn2Iwk4sKtoYh8WE8i1JOuY4=
Thanks. I was afraid of that,
but I was hoping that since Scala and Java
are meant to be seamlessly interoperable,
there would have be some some strong implementation indepent constraints
on the Scala2bytecode mapping that one could exploit in determining
what the poincuts are.
On 8/10/06, robert kuzelj <robert_kuzelj@xxxxxxxxx> wrote:
> 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
aspectj-users mailing list