The name of a class is retrievable from mirrors, but it is too heavy for just retrieving the class's name. It will be great if Type has a property providing the class name.
--
Consider asking HOWTO questions at Stack Overflow: http://stackoverflow.com/tags/dart
The name of a class is retrievable from mirrors, but it is too heavy for just retrieving the class's name. It will be great if Type has a property providing the class name.
On Sat, Oct 27, 2012 at 6:14 PM, Tom Yeh <tom....@gmail.com> wrote:
The name of a class is retrievable from mirrors, but it is too heavy for just retrieving the class's name. It will be great if Type has a property providing the class name.Try using the toString on the Type object. It should give you a name for the type.It should be the same name that occurs in Object.toString's "[Instance of Foo]".No guarantees that it always works, though :)
/L--
Lasse R.H. Nielsen - l...@google.com'Faith without judgement merely degrades the spirit divine'
Google Denmark ApS - Frederiksborggade 20B, 1 sal - 1360 København K - Denmark - CVR nr. 28 86 69 84
> That could work when you're just statically referencing things like String.name, but that doesn't seem too useful. More likely you're storing types in variables and collections and have functions that take types and then call .name(). Figuring out which type names to preserve would be tough.
How are GWT people doing this? They AFAIK support Class.getName().
I'd say that type name is important and my guess would be that it's also relatively cheap. What about just remembering it in _all_ cases?
LT
> That could work when you're just statically referencing things like String.name, but that doesn't seem too useful. More likely you're storing types in variables and collections and have functions that take types and then call .name(). Figuring out which type names to preserve would be tough.How are GWT people doing this? They AFAIK support Class.getName().
I'd say that type name is important and my guess would be that it's also relatively cheap. What about just remembering it in _all_ cases?
LT
There can be a lot of classes and therefore a lot of unused strings sitting around in an app...