Subj : Re: relating to JS_DefineFunction To : netscape.public.mozilla.jseng From : Brendan Eich Date : Mon Apr 25 2005 10:38 am Brendan Eich wrote: > SteveHolt wrote: > >>> use __noSuchMethod__ as well. >> >> >> >> I saw that pop its head up while testing. I think the original >> requested name is lost by then though. > > > > Not so: > > js> o = {__noSuchMethod__: function () { > print(Array.prototype.toSource.call(arguments); > }} Argh, bash history truncated my example, and my fixup after copy and paste wasn't right (obviously). For your strict-option compliant, copy and paste pleasure, make that: var o = { __noSuchMethod__: function () { print(Array.prototype.toSource.call(arguments)); } }; print(o.fooby()); // ["fooby", []] print(o.foopy()); // ["foopy", []] /be > js> o.fooby() > ["fooby", []] > js> o.foopy() > ["foopy", []] > > Unlike invocation in general, __noSuchMethod__ works (on purpose) only > for named calls (not indexed ones, or native ones where there is no > immediate name operand of a callee-computing bytecode sequence). > > /be .