I think it's a useful addition, but it does cause a little overhead (though it's probably not noticeable compared to the actual work the async function is doing). EventEmitters might feel the pain since they are sync. I do worry that it makes things harder for our argument guessing code that assumes the last arg is a callback. Now there will be an optional argument after the callback that can be anything (including another function)
On Fri, Jun 8, 2012 at 1:18 PM, AJ ONeal <coola...@gmail.com> wrote: > Yes, That's what I am suggesting. > > AJ ONeal > > > On Fri, Jun 8, 2012 at 12:17 PM, Tim Caswell <t...@creationix.com> wrote: > >> So this proposal is to modify the API of all async functions to have an >> extra thisp argument after the callback argument (like done in >> Array.prototype.forEach)? >> >> >> On Fri, Jun 8, 2012 at 1:06 PM, AJ ONeal <coola...@gmail.com> 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. >>> >>> The reason being is that I'm trying to eliminate anonymous callbacks >>> from my code and have generally cleaner, more readable code (as well as >>> lower memory usage and less garbage collection). >>> >>> I don't know if this has been discussed before, but I'd like to put it >>> on the table. >>> >>> AJ ONeal >>> >> >> >