-
Notifications
You must be signed in to change notification settings - Fork 475
Update beware-anonymous-functions.md #575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
"Better" was still using anonymous functions which are still a pain to debug..
|
The point is that this gives the (beginner) reader the impression that 'better' does not have anonymous functions. It does have anonymous functions and so it misinforms the reader. |
The article doesn't give the impression that the second example haven't got anonymous functions. The point of the article isn't that anonymous functions are bad, it just shows off that your code can get disorganized if you're binding them all over the place. The title is |
|
From the page * Instead, use an object literal to organize and name your handlers and callbacks.* In English, when you say instead <- that means something else (no more anonymous functions) I think the author has difficulties understanding the difference between an in-line function and an anonymous function. |
From just one sentence earlier, on the same page: Anonymous functions bound everywhere are a pain. What the author means is: So, instead of binding those everywhere around, store them using an object literal. |
|
We are saying the same thing, the author has nothing against anonymous functions, he is against inline functions. Perhaps the change should be : 'Functions bound everywhere are a pain.' Over and out. |
|
Seems like you haven't signed the CLA, could you handle that? Make sure the name and email in your git config matches the name and email you signed the CLA with. Also could you include your real name in the git config? Thanks! |
|
Also according to the ES6 spec, those functions get names anyway, there is no need to duplicate the name in those objects: http://bocoup.com/weblog/whats-in-a-function-name/ |
|
I agree something should change here, about this article, but I don't think copying the name onto the functions in the object is worthwhile. |
|
Also, named functions escape into the outer scope in IE<=8 and can cause much anguish. http://kangax.github.io/nfe/#jscript-bugs |
|
Only in IE<8 yeah? |
|
I believe it includes IE8, and Kangax mentioned it there as well. |
|
I believe it was IE<=8 indeed. Just for clarification: I also believe something should be changed/reworded, but I don't think copying the name onto the functions in the object is the fix we need. |
|
Something does need to change, but I don't think this pull is the right start. Happy to look over another change if needed. |
"Better" was still using anonymous functions which are still a pain to debug..