Yes, it is crazy. A constructor function can be aliased to any number  
of names and might get invoked through means other than by referring  
to a top-level variable name. It needn't even be assigned to a top- 
level variable name.

Also, multiple  constructor functions can have the same prototype  
property, effectively all of them constructing objects of the same  
"type". So the correlation between constructor names and prototypes  
(closest you can get to a class in JS) is many-to-many.

You can have your constructors put a special property in your objects  
for easily identifying them or something similar. You might even be  
able to somehow cleverly automate the process, but I can't think of  
any way in this instant.

Attila.

On 2007.11.23., at 21:37, Benson Margulies wrote:

> Sitting in eclipse puzzling over return values from calls into  
> Javascript, I
> find myself wishing that I could, for a NativeObject, find out the  
> name of
> the constructor that created it. Is that a crazy notion?

_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to