Re: Resp.: [Bindings] What does typeof return for interface objects?

Hi João.

João Eiras:
> It does not make sense to be only an object, because you can only have
> instances of functions and the instanceof operator requires a function
> on the right hand side. That ff3 thing might be a regression.

That’s not true.  This is what ECMA-262 says the behaviour of
‘RelationalExpression instanceof ShiftExpression’ should be:

  1. Evaluate RelationalExpression.
  2. Call GetValue(Result(1)).
  3. Evaluate ShiftExpression.
  4. Call GetValue(Result(3)).
  5. If Result(4) is not an object, throw a TypeError exception.
  6. If Result(4) does not have a [[HasInstance]] method, throw a
     TypeError exception.
  7. Call the [[HasInstance]] method of Result(4) with parameter
     Result(2).
  8. Return Result(7).

So all that is needed for something like ‘document instanceof
HTMLDocument’ to work is for the HTMLDocument interface object to
implement [[HasInstance]] (which is what section 4.2.1.1 requires).

Cameron

-- 
Cameron McCormack, http://mcc.id.au/
 xmpp:heycam@jabber.org  ▪  ICQ 26955922  ▪  MSN cam@mcc.id.au

Received on Tuesday, 18 March 2008 23:22:25 UTC