noSuchMethod: "funargs" + "invoke-only-phantoms"

Herby Vojčík herby at mailbox.sk
Sat Dec 17 05:21:39 PST 2011


Hello,

from my point the scenario that:

    delete lib.toRussianName;

    then it still:

    typeof lib.toRussianName; // "function", Trollface ;D

is much more acceptable (it happens everyday - there are non-writable 
properties everywhere), than the scenario where I cannot transform

    lib.toRussianName("Andrea"); // Андрей

into

    var toRussianName = lib.toRussianName;
    toRussianName.apply(null, ["Andrea", "Alex"]); // error, "toRussianName" 
is undefined

That's why I proposed first-class phantoms in gist: beasts that typeof to 
"phantom", ToBoolean to false, ToNumber to 0, are wrapping a function, 
[[Call]] calls that function, [[Get]] and [[Prototype]] delegates to that 
function ([[Class]] is questionable) and rest does not work ([[Set]] 
silently fails etc.). And the ability to return them from any code, not just 
proxies.

> Dmitry.

Herby 



More information about the es-discuss mailing list