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
classA{}
main() {
ClassMirror<A> classMirror = myReflectable.reflectType(A); // want ClassMirror<A> that have static type check !!! foo(ClassMirror<A> clazzOfA) {
print(clazzOfA.invoke("oneArgument", [84])); // do sth with class of A
}
}
//in javaClass<A> class = A.getClass(); // have static type check //...
The text was updated successfully, but these errors were encountered:
Guang1234567
changed the title
Why ClassMirror<T> is a generic type like Class<T> in C# or Java?
Why ClassMirror<T> is nota generic type like Class<T> in C# or Java?
Jan 2, 2019
Guang1234567
changed the title
Why ClassMirror<T> is nota generic type like Class<T> in C# or Java?
Why ClassMirror<T> is not a generic type like Class<T> in C# or Java?
Jan 2, 2019
Guang1234567
changed the title
Why ClassMirror<T> is not a generic type like Class<T> in C# or Java?
[Qestion][Enhanceman] Why ClassMirror<T> is not a generic type like Class<T> in C# or Java?
Jan 2, 2019
Guang1234567
changed the title
[Qestion][Enhanceman] Why ClassMirror<T> is not a generic type like Class<T> in C# or Java?
[Qestion][Enhancement] Why ClassMirror<T> is not a generic type like Class<T> in C# or Java?
Jan 2, 2019
We have discussed a similar proposal for the core class Type, where we would give it a type argument and let the Type instance which reifies the type T be an instance of a class that implements Type<T>, also motivated by the improved static safety.
So it's a useful feature. But it would not be possible to implement this in reflectable (that is, using regular Dart code, because reflectable is based on code generation) unless/until we have support for some additional features in this area in the core.
In particular, if you use reflector.reflect(myObject).type where myObject is an instance of C<T> for some type T, we must return a ClassMirror<T>. But there is no way to create such a mirror, except by putting code into the body of C where its type argument is in scope. We cannot do that; for instance, C could be the built-in class int, and code generation doesn't have the ability to edit class int; or C could simply be a class in some third-party package, and reflectable doesn't get to edit any such libraries (and we don't want to give reflectable the ability to edit third party libraries, even if it might technically be possible).
So I'll mark this issue as blocked on the lack of support in core, and note that it would still be useful to keep it in mind in the situation where the addition of such features to the core is considered.
Hello dev:
For example:
The text was updated successfully, but these errors were encountered: