I'd like to implement a generic function that provides an anonymous derived class from T
that provides an implementation of some certain function.
I'd like it to be like:
def impl[T] = new T{def f = 1}
Unfortunately I get:
<console>:11: error: class type required but T found
def impl[T] = new T{def f = 1}
Is there any way to do it without reflection?