W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2010

RE: [WebIDL] interface objects with [Constructor] and [[Call]]

From: James Graham <jgraham@opera.com>
Date: Fri, 11 Jun 2010 22:05:31 +0000
Message-ID: <20100611220531.l186y5qb0og0wg8w@staff.opera.com>
To: Travis Leithead <travil@microsoft.com>
Cc: Simon Pieters <simonp@opera.com>, "public-script-coord@w3.org" <public-script-coord@w3.org>, annevk@opera.com
Quoting Travis Leithead <travil@microsoft.com>:

> The way I interpret that, [[Call]] should equal [[Construct]] in all  
>  cases for host objects. Why? Because real-world code using   
> XMLHttpRequest today mixes and matches the invocation pattern:
>
> 'new XMLHttpRequest;'
> 'new XMLHttpRequest();'
> 'XMLHttpRequest();'
>
> and for web-compat, we want all of these to succeed.

Arguably the XMLHttpRequest spec special cases this so all three forms
work at [1] (I am not sure what exactly is meant by "constructor is
invoked" here since it could mean "[[Construct]] method is called" or
"[[Call]] method is called"; this should probably be clarified in the
spec). Therefore that is not a good example from which to derive a
general rule.

On general principles I would prefer [[Call]] === [[Construct]] for
new host object constructors; it seems closest to the behaviour of
ECMAScript builtins and convenient for authors, but for legacy
constructors we probably need to mimic deployed UA behaviour.

[1] http://www.w3.org/TR/XMLHttpRequest/#constructors
Received on Friday, 11 June 2010 22:06:07 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:02 UTC