Skip to content

Conversation

@konijn
Copy link

@konijn konijn commented Dec 5, 2014

"Better" was still using anonymous functions which are still a pain to debug..

"Better" was still using anonymous functions which are still a pain to debug..
@konijn
Copy link
Author

konijn commented Dec 9, 2014

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.

@arthurvr
Copy link
Member

arthurvr commented Dec 9, 2014

The point is that this gives the (beginner) reader the impression that 'better' does not have anonymous functions.

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 beware of ..., not avoid ....

@konijn
Copy link
Author

konijn commented Dec 9, 2014

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.

@arthurvr
Copy link
Member

arthurvr commented Dec 9, 2014

From the page * Instead, use an object literal to organize and name your handlers and callbacks.*

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.

@konijn
Copy link
Author

konijn commented Dec 9, 2014

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.'
Anyway, this is my last communication on this, I cant explain it any clearer ;)

Over and out.

@arthurvr
Copy link
Member

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!

@gnarf
Copy link
Member

gnarf commented Dec 23, 2014

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/

@gnarf
Copy link
Member

gnarf commented Dec 23, 2014

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.

@dmethvin
Copy link
Member

Also, named functions escape into the outer scope in IE<=8 and can cause much anguish. http://kangax.github.io/nfe/#jscript-bugs

@gnarf
Copy link
Member

gnarf commented Dec 23, 2014

Only in IE<8 yeah?

@dmethvin
Copy link
Member

I believe it includes IE8, and Kangax mentioned it there as well.

@arthurvr
Copy link
Member

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.

@gnarf gnarf closed this Dec 24, 2014
@gnarf
Copy link
Member

gnarf commented Dec 24, 2014

Something does need to change, but I don't think this pull is the right start. Happy to look over another change if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants