Scala proxy (first try of Scala's reflection API)

Hi,
I decided to give a try idea of implementing Scala counterpart of java.lang.reflect.Proxy functionality. Here's the result of quick hacking: http://goo.gl/5AmJd
Basically, the idea is to provide similar functionality to Proxy but using Scala reflection API types intead of Java ones. There are lots of benefits including proper handling of fancy method names like bar_!.
I think use of Proxies in Java is popular usecase for reflection and we provide our API for it too. Thoughts?
--
Grzegorz Kossakowski

Re: Scala proxy (first try of Scala's reflection API)

Wouldn't it be preferable to use Any in the signature of invoke, rather than Object?

2011/10/2 Grzegorz Kossakowski <grzegorz [dot] kossakowski [at] gmail [dot] com>
Hi,
I decided to give a try idea of implementing Scala counterpart of java.lang.reflect.Proxy functionality. Here's the result of quick hacking: http://goo.gl/5AmJd
Basically, the idea is to provide similar functionality to Proxy but using Scala reflection API types intead of Java ones. There are lots of benefits including proper handling of fancy method names like bar_!.
I think use of Proxies in Java is popular usecase for reflection and we provide our API for it too. Thoughts?
--
Grzegorz Kossakowski


Re: Scala proxy (first try of Scala's reflection API)

On 2 October 2011 23:05, Jordi Salvat i Alabart <jordi [dot] salvat [dot] i [dot] alabart [at] gmail [dot] com> wrote:
Wouldn't it be preferable to use Any in the signature of invoke, rather than Object?

I'd need to put AnyRef because Array (for args) is invariant. In principle, you are right. It's better to stick to Scala types.
Corrected.
--
Grzegorz Kossakowski

Copyright © 2013 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland