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
This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:14:24 UTC