- From: Domenic Denicola <domenic@domenicdenicola.com>
- Date: Sun, 1 Jun 2014 21:19:00 +0000
- To: Tab Atkins Jr. <jackalmage@gmail.com>
- CC: Anne van Kesteren <annevk@annevk.nl>, public-script-coord <public-script-coord@w3.org>, Joshua Bell <jsbell@chromium.org>, Jungkee Song <jungkee.song@samsung.com>, Yehuda Katz <wycats@gmail.com>, Alex Russell <slightlyoff@google.com>, Jonas Sicking <jonas@sicking.cc>, Jake Archibald <jaffathecake@gmail.com>, Tobie Langel <tobie.langel@gmail.com>, WebApps WG <public-webapps@w3.org>
From: Tab Atkins Jr. [mailto:jackalmage@gmail.com] > Using NamedConstructor is identical to doing: > > ```js > class Foo { ... } > let Bar = Foo; > // now I can do "new Foo()" or "new Bar()", to the same effect. > ``` Not true, since the constructors take different arguments. Instead it is equivalent to ```js class Response { constructor(body, init) { ... } ... } function RedirectResponse(url, status = 302) { return new Response(???, ???); } RedirectResponse.prototype = Response.prototype; ``` > What invariants are you concerned about? In particular, we have that ```js RedirectResponse.prototype.constructor !== RedirectResponse (new RedirectResponse(...)).constructor !== RedirectResponse // Also, omitting the `new` does not throw a `TypeError`, like it does for real constructors. ``` and possibly a few others I am forgetting.
Received on Sunday, 1 June 2014 21:19:34 UTC