Object.prototype.inspect ?

P T Withington ptw at pobox.com
Fri Mar 13 06:22:48 PDT 2009


On 2009-03-13, at 01:04EDT, Brendan Eich wrote:

> To your point, which I addressed in different terms: we could make  
> Object.prototype.toString look for [[Class]].[[Constructor]].name  
> where [[Constructor]] is unnameable-by-script and references the  
> class's constructor function. This would satisfy Tobie's wish while  
> avoiding the mutation hazards inherent in using constructor.name.  
> Either solution wants the function name property to be standard.

Can we go one step further?  I want (something like)  
Object.getOwnConstructor() to return Object.[[Class]]. 
[[Constructor]].  I want to be able to get a handle on the constructor  
of the object, not just the name of that constructor (since in some  
cases that name might be 'anonymous' which doesn't help me).  Is that  
a possibility?


More information about the Es-discuss mailing list