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

On 10/10/10, Cameron McCormack <cam@mcc.id.au> wrote:
> Cameron McCormack:
>>   2. Allow all constructors to be called as functions and have the same
>>      behaviour.
>>
>> I’ll make the spec do (2).
>
> So done:
>
>   http://dev.w3.org/2006/webapi/WebIDL/#es-interface-call
>   http://dev.w3.org/2006/webapi/WebIDL/#named-constructors
>

| A named constructor object that exists due to one or more
| [NamedConstructor]  extended attributes with a given identifier
| is a function object. It MUST have a [[Call]]  internal property,
| allows construction of objects that implement the interface on
| which the [NamedConstructor]  extended attributes appear.

Again, it is redundant to state that a function object has a [[Call]]
property. It is also redundant to say that the function is an object.
Functions are objects. Change every occurrence of "named constructor
object" to "named constructor".

I suggest rewording that.

[NamedConstructor] function
When a named constructor is called as a function, it creates and
initializes a new object of the interface type.

Question: Do you have any real examples of a NamedConstructor? And if
so, please provide one. TIA.
-- 
Garrett

Received on Monday, 11 October 2010 03:21:38 UTC