You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the current scheme of things, performing reflective invocations that are more or less simple in such languages/systems as Java and C# is quite convoluted.
When you want to reflectively call a method on a given object in Java, you figure out the object's class, then look up the corresponding java.lang.reflect.Method and finally simply call Method.invoke, passing the given object and the arguments.
In Scala this requires a significant amount of ceremony. First you have to obtain a runtime mirror, then you use it to reflect the object's class symbol, then you look up a method symbol in that class, then you need to obtain a method mirror using the calculated method symbol, and only then can you call apply on the resulting mirror.
The text was updated successfully, but these errors were encountered:
@xeno-by said:
One of the ideas to improve usability is to merge traversals of the symbol table (reflecting a class, looking up a method) with reflection performed on mirrors. If we could say ru.reflect(instance).reflectMethod(name)(args), then things would become much better.
In the current scheme of things, performing reflective invocations that are more or less simple in such languages/systems as Java and C# is quite convoluted.
When you want to reflectively call a method on a given object in Java, you figure out the object's class, then look up the corresponding
java.lang.reflect.Method
and finally simply callMethod.invoke
, passing the given object and the arguments.In Scala this requires a significant amount of ceremony. First you have to obtain a runtime mirror, then you use it to reflect the object's class symbol, then you look up a method symbol in that class, then you need to obtain a method mirror using the calculated method symbol, and only then can you call apply on the resulting mirror.
The text was updated successfully, but these errors were encountered: