domenic at domenicdenicola.com (2014-06-20T19:34:33.602Z)
I forgot to add: then the rare code that really wants to ask "is x a
constructor?" can say
if (x[Symbol.new] !== undefined) ...
like Array.from does for @@iterator.I forgot to add: then the rare code that really wants to ask "is x a
constructor?" can say
if (x[Symbol.new] !== undefined) ...
like Array.from does for @@iterator.
On Thu, Jun 12, 2014 at 1:30 PM, Jason Orendorff <jason.orendorff at gmail.com> wrote: > I *really* wish we just had an @@new for this, such that > new C(...args) > is just shorthand for > C[Symbol.new](...args) > and the construct trap could be removed from proxies altogether. :-| I forgot to add: then the rare code that really wants to ask "is x a constructor?" can say if (x[Symbol.new] !== undefined) ... like Array.from does for @@iterator. -j