Hello Mark,

Sunday, May 2, 2010, 1:02:36 AM, you wrote:

> On Sat, May 1, 2010 at 1:27 PM, Brendan Eich <[email protected]> wrote:
>> On May 1, 2010, at 12:34 PM, Faisal Vali wrote:
>>
>>> As I read the proposal, I do wish an invoke-like trap had been
>>> accepted - but I understand that there were some technicalities that
>>> proved unresolvable.
>>
>> Everyone wants __noSuchMethod__

> I don't. I want proxies instead. ;)


By the way, why exactly proxies? And not special meta hooks such as
__noSuchMethod__, __construct__, __call__, __get__, __set__ and other?

This seems again a bit overloaded, to create first a real object;
then to create a proxy for it, and because of we can use the proxy
object in all related actions (via hooks get, set, hasOwn, enumerate,
fix and other) -- to work after that only with that
proxy (and forgot about the original object).

Why does committee dislike the special meta methods directly on
objects? It seems useful

let o = {
  // called for every reading
  __get__: function (name) {
    //
  },

  __set__: funciton (name, value) {
    //
  },

  // ability to make an object callable
  __call__: funciton (...args) {
    //
  },

  // only for not found in
  // the prototype chain
  __noSuchMethod__: function (name, args) {
    var delegate = this.getDelegateFor(name);
    delegate && delegate.call(this, args);
  },

  __noSuchProperty__: funciton () {
    //
  },

  getDelegateFor: function (name) {
    for (let k = this.delegates.length; k--;) {
      if (typeof this.delegates[k] == "funciton")
        return this.delegates[k][name];
    }
    return null;
  }

  // additional prototypes
  // for delegation
  this.delegates: [proto1, proto2]
};

o.foo(); // __noSuchMethod__
o.bar; // __get__, __noSuchProperty__


And so on. Yes, it looks like a full Python's copy, but, isn't it
convinient and useful?

Having simple definition, at the same time still there is
stratification of "Meta" and "App" levels. Thus, implementation and
standard should say that all __propertyNames__ are reserved to be
meta.

Dmitry.

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to