I'm still not 100% comfortable with Array.create vs. the array subtyping spec [1]. In the context of my earlier email (Object.subclass or whatever i called it) I think a subclassing function is much nicer, more generic, and doesn't require the spec to be littered with .create methods. It also extends "trivially" to non-es objects, eg. Object.subclass(Image) or somesuch in the DOM, etc.
--Oliver [1] http://wiki.ecmascript.org/doku.php?id=strawman:array_subtypes On Mar 18, 2011, at 10:08 AM, Allen Wirfs-Brock wrote: > There is a general problem of supporting creation of special behavior > objects (EG, Boolean, RegExp, anything fronted by a Proxy(??)) with arbitrary > prototypes that I'm looking at for a Harmony strawman. However, I think in > practice that this occurs very rarely for anything other than Array. > > I would be ideal if TC39 could agree upon an Array.create proposal at its > next meeting. This would enable implementations to immediately move towards > providing a standards path alternative to what is probably the major use > case for LHS __proto__. > > Array create seems like a good interface for that particular use case even if > the general solution that encompasses things other than Array ended up being > something different. > > Allen > > > > > On Mar 18, 2011, at 9:46 AM, Mike Shaver wrote: > >> On Fri, Mar 18, 2011 at 9:29 AM, John-David Dalton >> <[email protected]> wrote: >>> @Mike Shaver >>> For other possible uses please check out: >>> http://msdn.microsoft.com/en-us/scriptjunkie/gg278167 >>> https://github.com/jdalton/fusebox#readme >> >> Those all look like they are needing custom-initialization, not >> arbitrary mutation at any point. Would you agree? For symmetry with >> Object.create, you might want Boolean.create, Date.create and so >> forth, but that's still initialization-time, and TBH I would be >> surprised if there were actually many collisions between libraries >> that augment those prototypes. >> >> Preserving (or adding to other engines) arbitrary prototype chain >> mutation in order to work around name collisions seems wrong to me. >> Mutable proto just happened to be the hack that worked (though so did >> iframes), and I can't really find anything other than Fuse that uses >> it on the web today. The solution to name collisions is simple >> modules, IMO, not monkeypatching of the builtin prototype hierarchy. >> >> I think you can also achieve what you want with Harmony proxies, so >> you'll have that option in the next edition of ES. >> >> Mike >> _______________________________________________ >> es-discuss mailing list >> [email protected] >> https://mail.mozilla.org/listinfo/es-discuss > > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

