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 'this'.

You'd just need have the function assign 'me = arg0' rather than 'me =
this'.

On Sunday, June 10, 2012, Isaac Schlueter wrote:

> 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.  That's the problem ()=>{} addresses.  If you don't like
> bind(), and can't wait for fat-arrow, then do `var me = this` and deal
> with it that way, or wrap your functions like:
>
> function foo (me) { return function () {
>  me.doWhatever()
> }}
>
> setTimeout(foo(this), 1000)
>
> Sorry.  It's a lovely suggestion, but we don't need this in core.  The
> answer is no.
>
>
> On Sun, Jun 10, 2012 at 12:20 AM, Jorge 
> <jo...@jorgechamorro.com<javascript:;>>
> 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 to the
> callback.
> >
> > But don't call it context please the proper name is receiver. A context
> in JS is much more than "this" :-P
> > --
> > Jorge.
>


-- 
AJ ONeal
(317) 426-6525

Reply via email to