I can think of some interesting use cases for implementing [[call]] on an interface object... I'd prefer to leave it unspecified at best. I agree with Hixie on the point of specifying the behavior of typeof, and to me typeof HTMLDocument == 'function' makes sense, since I think of these as 'constructor objects' (even if they don't allow object construction in some cases).
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Cameron McCormack Sent: Tuesday, March 18, 2008 4:19 PM To: Web APIs WG (public) Subject: Re: [Bindings] What does typeof return for interface objects? Hi Travis. Travis Leithead: > From the spec... > > 4.2.1. Interface object > > The interface object for a particular interface has an internal > [[Prototype]] object whose value is the Object prototype object. > > So, can infer that the interface object (lets use HTMLDocument) *is > an* Object? Or is it a Function? I don’t think you can infer either of these. Whether ‘typeof x’ will evaluate to "object" or "function", assuming ‘x’ is an object, depends only on whether the object implements [[Call]]. The spec doesn’t say anything about [[Call]] on interface objects at the moment, so I think either would be acceptable. > ("object" == typeof HTMLDocument) ? "It's an object" > : ("function" == typeof HTMLDocument) ? "It's a function" > : "What is it?"; > > I see that browsers disagree and that FF3 B4 recently changed to be > 'object'. Leaving Opera in the wrong? I wouldn’t say Opera is wrong, but there is probably no need to an interface object to implement [[Call]] anyway. Do you think the spec should explicitly say that [[Call]] must not be implemented? IMO there isn’t much gain from doing that. Cameron -- Cameron McCormack, http://mcc.id.au/ xmpp:[EMAIL PROTECTED] ▪ ICQ 26955922 ▪ MSN [EMAIL PROTECTED]
