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

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


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"); // Андрей


    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 

> Dmitry.


More information about the es-discuss mailing list