On Fri, May 4, 2012 at 2:28 AM, Stefan Zeiger <
sze...@novocode.com> wrote:
> Those signatures are not actually required. Dynamic does purely syntactic
> rewriting of the method calls, so any signature will do as long as the
> arguments match.
Yeah, in my faux checkin branch, it says:
/** An extension of Dynamic which abstractly defines the methods
* eligible to receive dynamic invocations. These are general
* signatures, using `Any` in all positions; more specific
* signatures can be written, but because method parameter types cannot
* be refined in subclasses, you will want to extend Dynamic directly
* to do that.
*/
trait DynamicInterface extends Dynamic {
def selectDynamic(method: String): Any
def applyDynamic(method: String)(args: Any*): Any
def applyDynamicNamed(method: String)(args: (String, Any)*): Any
def updateDynamic(method: String)(args: Any*): Any
}
I also have this guy doing his thing, although given recent events it
seems comically primitive to do reflection this way.
scala> val r = new Dynamic.Reflecto(List(1,2,3))
r: Dynamic.Reflecto = scala.Dynamic$Reflecto@7110506e
scala> r sorted implicitly[Ordering[Int]]
res0: Any = List(1, 2, 3)
scala> r sorted implicitly[Ordering[Int]].reverse
res1: Any = List(3, 2, 1)