Erik Arvidsson (2014-06-12T15:30:47.000Z)
domenic at domenicdenicola.com (2014-06-20T19:32:44.671Z)
On Thu Jun 12 2014 at 10:59:57 AM, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote: > The problem with the undefined test is that it doesn't work if somebody > tries to attach such functions to a namespace object: It should not work. These are methods that depends on `this`. ```js var ns = {create: document.createElement}; ns.create('div'); // throws wrong receiver ``` > ```js > let arraybuilder = {of: Array.of, from: array:Array.from}; > arraybuilder.of(1,2,3,4); > ``` > > or consider, at the global level: > ```js > var of = Array.of; > of(1,2,3); //works > this.of(1,2,3) //breaks > ``` Why can't we "blindly" call `this[[Construct]]`? It will throw for all of the above cases which is pretty much what one would expect.