scalax.reflect?
I've been tinkering with the bare bones of a little reflection library
for Scala in my spare time and it occurred to me to wonder if there
was any interest in merging something like that into scalax and
turning it into more of a community effort. I'm sure other people have
done some stuff towards this as well (I know Aaron Harnly has been
doing some interesting things with reflection. That's part of what
prompted me to look into this), so pooling efforts and getting
additional use cases for it seemed like a good idea.
The basic goal at the moment is to be able to:
- Dynamically invoke methods on Scala objects as something like
call("foo", args). This should be aware of Scala specific features
like symbolic names, call by name arguments, varargs, etc as well as
resolve overloads at runtime.
- Create new instances of Scala types in a similar way.
- Create proxies in a way that understand the traits implementation,
so you only need to proxy abstract methods in a trait and you'll get
the rest for free.
I've got the basics of the first two working (symbolic names work,
although not for converting to primitive equivalents yet, varargs and
call by name arguments don't except in the sense that if you pass
instances of the wrapper type it will work, overloading is currently
only kinda sorta resolved but I know how to fix it) and not done much
on the third.
Also I'm trying to design the library in a way that doesn't require
explicit mention of anything from java.lang.reflect. I've no interest
in working on a .NET backend for it, but it should probably be
designed in such a way as to not preclude the existence of one.