examples of scala.reflect.api 2.10

349 views
Skip to first unread message

Alberto SOUZA

unread,
Mar 3, 2012, 9:39:50 PM3/3/12
to scala-user
Hi,

Are there any examples of the new reflection api provided by scala 2.10? I was taking a look here => https://github.com/scala/scala/blob/master/src/compiler/scala/reflect/runtime/Mirror.scala

Thanks,

Alberto

Nada Amin

unread,
Mar 5, 2012, 5:34:11 PM3/5/12
to Alberto SOUZA, scala-user
Hi Alberto,

Here is a small project which shows how to create the Scala
counterpart of Java proxies:
https://github.com/namin/scala-proxy

It uses Scala reflection instead of Java reflection for the invocation
handlers. In particular, see:
https://github.com/namin/scala-proxy/blob/master/src/main/scala/scala/reflect/proxy/ScalaProxy.scala
https://github.com/namin/scala-proxy/blob/master/src/main/scala/test/Main.scala

>
> Thanks,
I hope this helps. Please don't hesitate if you have any questions.

Cheers,
~n

>
> Alberto

Nada Amin

unread,
Mar 5, 2012, 5:58:24 PM3/5/12
to Alberto SOUZA, scala-user
On Mon, Mar 5, 2012 at 11:34 PM, Nada Amin <na...@alum.mit.edu> wrote:
> Hi Alberto,
>
> On Sun, Mar 4, 2012 at 3:39 AM, Alberto SOUZA <alot...@gmail.com> wrote:
>> Hi,
>>
>> Are there any examples of the new reflection api provided by scala 2.10? I
>> was taking a look here
>> => https://github.com/scala/scala/blob/master/src/compiler/scala/reflect/runtime/Mirror.scala
> Here is a small project which shows how to create the Scala
> counterpart of Java proxies:
> https://github.com/namin/scala-proxy
FYI, I just updated this project to run with Scala 2.10.0-M2. The API
improved in clarity between M1 and M2.

Alberto SOUZA

unread,
Mar 8, 2012, 10:10:34 AM3/8/12
to Nada Amin, scala-user
Thanks Nada. I took a look at the scala repo. At the end, I wrote a post about the new reflection api => http://alots.wordpress.com/2012/03/06/getting-into-the-new-scalas-2-10-reflection-api/
Reply all
Reply to author
Forward
0 new messages