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

-various people

Garrett Smith:
> | 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.

I agree that it is redundant to state that a function object has a
[[Call]] property.  I don’t think it is redundant to state that it has a
[[Call]] property with particular behaviour, though.

> It is also redundant to say that the function is an object.
> Functions are objects.

That is true.  Are you asking for me to change instances of “function
object” to just “function”?

> Change every occurrence of "named constructor object" to "named
> constructor".

I named that term “named constructor object” analogously to “interface
object”, “interface prototype object”, etc.  But I can see that it is
not consistent with the name of the [NamedConstructor] extended
attribute, either.  I’m fine with changing it 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.

Yeah, it’s probably fine to avoid talking about [[Call]] explicitly and
talk rather about the behaviour of the function when called.

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

There is one in the spec:

  http://dev.w3.org/2006/webapi/WebIDL/#NamedConstructor

Search for “Audio”.  That’s taken from the HTML5 spec.

-- 
Cameron McCormack ≝ http://mcc.id.au/

Received on Monday, 11 October 2010 05:53:38 UTC