domenic at domenicdenicola.com (2014-06-20T19:23:43.449Z)
On Wed, Jun 11, 2014 at 11:05 AM, Boris Zbarsky <bzbarsky at mit.edu> wrote: > This will fail for constructors that require actual arguments, right? > > For example, this will fail if `C === window.Worker` in a browser. It will also fail for the uses of `IsConstructor` in the promise spec, as `Promise` constructors throw `TypeError` unless they are passed a callable `resolve` argument (IIRC).
On Wed, Jun 11, 2014 at 11:05 AM, Boris Zbarsky <bzbarsky at mit.edu> wrote: > On 6/11/14, 10:58 AM, Rick Waldron wrote: >> >> function isConstructor(C) { >> try { >> new C(); > > > This will fail for constructors that require actual arguments, right? > > For example, this will fail if C === window.Worker in a browser. It will also fail for the uses of `IsConstructor` in the promise spec, as `Promise` constructors throw `TypeError` unless they are passed a callable `resolve` argument (IIRC). --scott