Skip to content
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

Add Arrow Function lexical arguments example #87

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

empyrical
Copy link

No description provided.

@PandaWhisperer
Copy link

I recently found out about this behavior the hard way, which caused me considerable emotional distress. This PR would have helped me avoid that.

Please merge.

@empyrical
Copy link
Author

Not sure if my PR has any issues or not (maybe my example is awkward?) In the meantime though you could use the spread operator on arrow funcs to get that behaviour, like so:

fs.readFile('package.json', (...args) => { console.log(args) })

@PandaWhisperer
Copy link

PandaWhisperer commented May 31, 2016

Thanks @empyrical. Brendan Eich told me the same thing after I forwarded him my tweet. Had a discussion with him on Twitter about this the other day. Good guy.

I hope your PR gets merged soon. I really like this repo and I've used it as a reference to learn ES6. Until I ran headfirst into this issue without any warning and felt like there definitely should have been one. Could have saved me a couple hours of debugging and wondering whether I've gone insane or my computer did.

I'm just so used to using console.log(arguments) to debug my call parameters anytime something doesn't work as expected, and suddenly, that was giving me anything from an exception to undefined to completely different arguments. Very annoying to say the least. Like walking full speed into a glass door.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants