- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Scala proxy (first try of Scala's reflection API)
Sun, 2011-10-02, 20:12
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
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
Sun, 2011-10-02, 22:57
#2
Re: Scala proxy (first try of Scala's reflection API)
On 2 October 2011 23:05, Jordi Salvat i Alabart <jordi.salvat.i.alabart@gmail.com> wrote:
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
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
Sun, 2011-10-02, 23:17
#3
Re: Scala proxy (first try of Scala's reflection API)
On Sun, Oct 2, 2011 at 12:11 PM, Grzegorz Kossakowski
wrote:
> I think use of Proxies in Java is popular usecase for reflection and we
> provide our API for it too. Thoughts?
Maybe at least take a glance at all this stuff I already wrote.
https://github.com/scala/scala/tree/master/src/compiler/scala/tools/refl...
https://github.com/scala/scala/tree/master/src/compiler/scala/tools/refl...
https://github.com/scala/scala/tree/master/src/compiler/scala/tools/refl...
https://github.com/scala/scala/tree/master/src/compiler/scala/tools/refl...
https://github.com/scala/scala/tree/master/src/compiler/scala/tools/refl...
https://github.com/scala/scala/blob/master/src/compiler/scala/tools/util...
2011/10/2 Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com>