Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Re: AspectJ + Scala

Robert,

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.

cheers
D

On 8/10/06, robert kuzelj <robert_kuzelj@xxxxxxxxx> wrote:
hi daniel,

> 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
> Scala.
> 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
will see.

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.

ciao robertj

> Are there any known issues with this?
> I am also interested in people's experiences
> using AspectJ with other non-java JVM languages.
>
> thanks
> Daniel
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



Back to the top