My ECMAScript 7 wishlist

Andrea Giammarchi andrea.giammarchi at
Fri Sep 26 03:09:15 PDT 2014

The only reason I've used `__noSuchProperty__` name in that example was to
indeed remind `__noSuchMethod__` and others anti-name-clashing old patterns
we all know but basically I was trying to explain that composing instead of
extending is a win for these kind of "magic" behaviors.

It is possible to use a Proxy without needing to go up to Object.prototype:

// before creating instances of MyClass
// after MyClass definition ...

but what if we'd like to add more than one "magic" functionality ?

I also agree with Tab that is not so trivial to add is kind of
functionality the right way.

The old way ( I am not rehashing here, just explaining ) would have made
everything easy for developers:

// easy ES3 shenanigans anti JIT
MyClass.prototype.__noSuchMethod__ = function (id, args) { ... };

// fast path via Symbols as ES6 likes them ...
MyClass.prototype[Symbol.noSuchProperty]= function (id) { ... };

Although using all these Symbols to simulate what traits would do in other
languages does not feel right.

About TC39 simplifying dev life, well ... isn't that the purpose of most
ES6 new features and sugar ?

So yes, there's some good intent and job going on here but few times I've
also read something like: "it's hard for engines but there are APIs that
let you do that on JS side" ... now, imagine how hard and potentially wrong
or slow would be in developers hands instead ...

As summary, I don't have a solution or a proposal for noSuchProperty and I
honestly don't feel the need for it (because Proxy) but I'd like to see
some discussion (in another thread maybe) about lightweight traits that are
also in Nicolas list (last point of his initial email)

Best Regards

On Fri, Sep 26, 2014 at 1:38 AM, Brendan Eich <brendan at> wrote:

> On Sep 25, 2014, at 7:56 PM, Boris Zbarsky <bzbarsky at> 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 " is not callable" or worse,
> " is not defined" error.
> IOW nSM only kicked in when evaluating
> Not just
> 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.
> /be
> _______________________________________________
> es-discuss mailing list
> es-discuss at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list