On Nov 10, 2007, at 5:17 PM, Garrett Smith wrote: > I know it's too late for a proposal, but I keep wanting a couple of > things for AOP stuff. > > One is a newApply > > Creational = { > getByNode : function(el){ > if(!this.hasOwnProperty("instances")) this.instances = {}; > return this.instances.hasOwnProperty(el.id) && this.instances > [el.id] || > (this.instances[el.id] = this.new.apply(arguments)); // <-- > Fictitious syntax. > } > } > > function Widget(el, dir){ > > } > > Wiget.getByNode = Creational.getByNode; // Borrow the getByNode method > > So that way, I can have a Widget based on a node, yet still pass > varargs to the constructor.
Got your back here ;-). Narcissus (http://lxr.mozilla.org/mozilla/ source/js/narcissus/) wants this too, and it's going to end up falling out of the reflection APIs: reflect::typeOf(this).reflect::construct(arguments) or of course: { use namespace reflect; . . . typeOf(this).constructo(arguments) } in your example. The http://wiki.ecmascript.org/doku.php? id=proposals:meta_objects proposal is out of date, it uses iterators for the type and value parameters, but IIRC we have agreement to satisfy your use-case. See http://bugs.ecmascript.org/ticket/232. /be _______________________________________________ Es4-discuss mailing list Es4-discuss@mozilla.org https://mail.mozilla.org/listinfo/es4-discuss