any update on catchalls for harmony?

Faisal Vali faisalv at yahoo.com
Tue Feb 3 12:51:11 PST 2009


On Tue, Feb 3, 2009 at 12:05 PM, Yehuda Katz <wycats at gmail.com> wrote:
> I'll reiterate my support for prop_missing. I'd be curious how you'd
> expected added/inherited hooks to work with ES.
>

Well - I admit I haven't give it too much thought - but thinking about
it cursorily:

What if everytime the prototype property is modified - trigger a hook
in the object whose prototype is being set, and and tigger a hook in
the object that is being set as the prototype.  This would be trivial
to do within Object.create() (assuming this feature is desirable).  It
would be trickier to do if we wanted these hooks called upon manual
update of the internal [[proto]] property.

dog.__proto__ = new Animal();
Although it seems that there is no way in standard ecmascript to
change an object's internal [[prototype]] property once it is set.

Hmm - and more importantly than that - what should happen here: new Animal();

A new object gets created, and its prototype is set (to
Animal.prototype) - but does it make sense for hooks to be called in
the new object (i.e. the hook would have to reside in Object.prototype
?)

Anyway - i'm not sure I have any good use cases for these hooks - so
unless someone feels like this is a useful feature - I am ambivalent
on the issue.

regards,
Faisal Vali
Radiation Oncology
Loyola


More information about the Es-discuss mailing list