Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Non-anonymous functions broken in 7e831bf #546

Closed
tswicegood opened this issue Jan 2, 2011 · 4 comments
Closed

Non-anonymous functions broken in 7e831bf #546

tswicegood opened this issue Jan 2, 2011 · 4 comments

Comments

@tswicegood
Copy link

As of 7e831bf, non-anonymous functions are broken in the REPL. I'm not sure when the issue was introduced, I first encountered it when testing the fix for #543.

See this gist for error output.

@tswicegood
Copy link
Author

Looks as though this was introduced in b45698e. Resetting to that causes foobar(); to think its inside a block (the prompt switches to ...), while calling foobar(); causes a ReferenceError to be raised.

@tswicegood
Copy link
Author

This was finished in 00974df, which makes foobar() generate a ReferenceError as well.

@tswicegood
Copy link
Author

I've also updated the Gist linked above to contain sample output. It's the parenthesis which cause the issue here. The parenthesis are pulling the name of the function into another scope which causes issues if you want to reference it again later.

This does add to the wtf-factor for newbies as a lot of developers aren't going to understand the difference between var foo = function() and function foo(), but I'm not sure on the best way to proceed about handling this.

@ry
Copy link

ry commented Jan 3, 2011

fixed in feb77ea

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants