Using function.prototype.bind without breaking function.prototype.apply
Jake Verbaten
raynos2 at gmail.com
Wed Sep 7 14:46:44 PDT 2011
var f = function() { return this; }
var g = f.bind(???);
g.apply({ "foo": "bar" }).foo // expect "bar"
Function.prototype.bind set's the thisArg to a certain value. Is there any
way to leave it flexible to be overwritten using `.call` and `.apply` later
on?
Is there any ES:Harmony/strawman proposal for this?
If there is not I propose using `undefined` to tell Function.prototype.bind
to leave thisArg flexible.
The use case would be using .bind to curry parameters without effecting
this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110907/a05da537/attachment.html>
More information about the es-discuss
mailing list