Skip to main content

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

Hi Daniel -

> > in the end what you want is possible but i would strongly
> > advise against it.

I have no experience with AspectJ + Scala but I wouldn't let *possible*
problems stop you; I believe some experiments could be beneficial for you 
and would benefit both projects.

One goal would be to avoid thinking about bytecode entirely but identify 
with a few source tests the Scala constructs that work as Java join points.  
You might find e.g., that method- and constructor- execution and call
and field get/set have sensible signatures and work fine, and that 
you only need that restricted set for the aspects you envision.  If you
take that approach I'd be happy to work with you identifying coverage
areas.

Of course, I'm biased: we'd appreciate knowing the list of join points 
that work (or not) in Scala, and I'm sure the Scala team would like 
to know what pointcuts and ITD's work.

Thanks -
Wes

> ------------Original Message------------
> From: "Daniel Mahler" <dmahler@xxxxxxxxx>
> To: aspectj-users@xxxxxxxxxxx
> Cc: "scala" <scala@xxxxxxxxxxxxxx>
> Date: Thu, Aug-10-2006 8:12 AM
> Subject: [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
> >
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
> 



Back to the top