On Thu, Sep 25, 2014 at 5:38 PM, Brendan Eich <bren...@mozilla.org> wrote:
> On Sep 25, 2014, at 7:56 PM, Boris Zbarsky <bzbar...@mit.edu> wrote:
>>
>> SpiderMonkey used to support __noSuchMethod__, I believe.
>
> I implemented __noSuchMethod__ long ago, for the TIBET folks (Smalltalk style 
> JS framework; they wanted a doesNotUnderstand analogue).
>
> Please note well the difference between __noSuchMethod__ and anything like 
> __noSuchProperty__. Even ignoring JITs, back in the interpreter only days, I 
> could justify nSM because it was called on a slow path, when the only outcome 
> without it was a guaranteed "obj.foo is not callable" or worse, "obj.foo is 
> not defined" error.
>
> IOW nSM only kicked in when evaluating
>
> obj.foo(args)
>
> Not just
>
> obj.foo
>
> Any nSP of the kind we seem to be discussing would need to fail fast, on 
> evaluation of the dot expression. That is a fast path.

I, personally, have only ever used Python and PHP's nSP functionality
to implement methods.  Most of the fancy uses I see for it in, say,
Ruby (like the cool dynamic query methods on ORMs), are also methods.
There are certainly uses for this kind of functionality for non-method
properties, but I suspect just going with noSuchMethod would satisfy
most use-cases.  I'd certainly be happier with that. ^_^

~TJ
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to