On Jun 8, 2012, at 8:06 PM, AJ ONeal wrote:
> I would like to propose that an additional parameter, `context` be added to
> core node modules that accept callbacks to give this-ness to the callback.
But don't call it context please the proper name is receiver. A context in JS
is much more than
I don't understand why:
setTimeout(function (x, y, z) {
// ...
}, this, 1000)
is better than:
setTimeout(function (x, y, z) {
// ...
}.bind(this), 1000)
The problem is that it puts `this` at the bottom of the function,
instead of signaling it at the top when you enter the function
visually.
On Jun 10, 2012, at 9:39 AM, Isaac Schlueter wrote:
>
> On Sun, Jun 10, 2012 at 12:20 AM, Jorge wrote:
>> On Jun 8, 2012, at 8:06 PM, AJ ONeal wrote:
>>
>>> I would like to propose that an additional parameter, `context` be added to
>>> core node modules that accept callbacks to give this-ness
I think what he was suggesting means the difference between
setTimeout(foo.func, foo, 1000);
and
setTimeout(foo.func.bind(foo), 1000);
which have pretty drastically different performance characteristics. That
being said, compared to the overhead of setTimeout itself, or just about
any async ca
If
setTimeout(foo.func.bind(foo), 1000) is so drastically slower than
setTimeout(foo.func, foo, 1000) then our aim for the benefit of the
language should be to improve the performance of bind(). A lot of
scenarios would benefit from improved bind() performance and we should
not create kludge for th
__proto__ is likely going to be in the ES6 spec as at least normative
optional. Recent discussions indicated there's some chance it will become
full-fledged part of the spec.
http://wiki.ecmascript.org/doku.php?id=strawman:magic_proto_property
https://mail.mozilla.org/pipermail/es-discuss/2012
>
> Sorry I didn't read all of the replies, but it makes total sense to me,
> nextTick should run before anything else.
I just want to point out that there's no need for such a shim for
setTimeout anyway - and it would break existing APIs - making it a
particularly invalid misinterpretation of my intended request.
It already takes arguments which a pretty acceptable way to work around the
issue. You can pass the '