On Sat, May 1, 2010 at 3:16 AM, Jürg Lehni <[email protected]> wrote:
> > Also, could you show me a real world use case of the argument concatenation > feature found in hitch and bind? I am not working with Prototype nor Dojo, > but so far I have not come to face a situation where this would have been > useful. The resulting code seems rather confusing to me, very hard for > someone else than the writer to figure out what is actually going on. > > I agree that all of the following cases do not by themselves represent a good reason to make bind() official. Rather, you could consider them more like "stupid bind() tricks." 1) http://code.google.com/p/es-lab/source/browse/trunk/src/jsonMLWalkers.js#66 Also lines 88 and 128 make the same point. 2) Because ES3 has no "...", Cajita currently needs the triangle of hackery found at http://code.google.com/p/google-caja/source/browse/trunk/src/com/google/caja/cajita.js#3801 Even though ES5 still has no "...", we can still replace the triangle of hackery with: function construct(ctor, args) { ctor = asCtor(ctor); // if you don't know Caja, don't worry about this line var boundCtor = Function.prototype.bind.apply(ctor, args); return new boundCtor(); } Note: since no one has implemented primitive bind() yet, the above code is completely untested. -- Cheers, --MarkM
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

