Re: Defining a constructor for Element and friends

Ryosuke Niwa <[email protected]> Tue, 13 Jan 2015 23:46:14 -0800
Newsgroups gmane.comp.web.dom.general,gmane.org.w3c.webapps
Message-ID <[email protected]>
> On Jan 13, 2015, at 8:26 PM, Domenic Denicola <[email protected]> wrote:
> 
> From: Bjoern Hoehrmann [mailto:[email protected]] 
> 
>> I know that this a major concern to you, but my impression is that few if any other people regard that as anything more than "nice to have", especially if you equate "explaining" with having a public API for it.
> 
> How do you propose having a private constructor API?

I don't think we need to make the constructor of HTMLUnknownElement private.  It certainly isn't today.  We just need to throw whenever it's called.

> How do you propose instances of the objects even existing at all, if there is no constructor that creates them?
> 
> This is one of those "only makes sense to a C++ programmer" things.

We can model it as a constructor that takes a private symbol only the DOM implementation has access to, and throws whenever this symbol is not passed in as an argument.

- R. Niwa