On Mar 13, 2009, at 6:22 AM, P T Withington wrote:

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?

For Harmony, sure. It would be Object.getConstructor, I think, since there is no connotation of "get property from this object or an object on its prototype chain", but Allen may have a different thought.

For ES3.1 the time to propose this was last year when the spec was in flux, freely available for review, and not being frozen for implementation.

Sure, we could "sneak" Object.getConstructor in, but that is a good way to be late and bloated if done for N such "easy additions", N growing quite large as we go. Maybe we can agree to hold the line "just this once". I'm skeptical; a precedent often takes on a life of its own.

/be
_______________________________________________
Es-discuss mailing list
Es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to