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

Broken nested funcs with curly args adds outer func to workspace #25205

Open
djsegal opened this issue Dec 20, 2017 · 5 comments
Open

Broken nested funcs with curly args adds outer func to workspace #25205

djsegal opened this issue Dec 20, 2017 · 5 comments

Comments

@djsegal
Copy link

djsegal commented Dec 20, 2017

Simplest Example:

function foo()
   function bar(fizz::Buzz)
   end
end

gives you:

ERROR: UndefVarError: Buzz not defined

however, foo is still defined:

> isdefined(:foo)
true

> foo
foo (generic function with 0 methods)
@djsegal djsegal changed the title Nested funcs with curly add outer func to workspace Broken nested funcs with curly args adds outer func to workspace Dec 20, 2017
@JeffBezanson
Copy link
Sponsor Member

I'm inclined to say this is won't-fix; in general if part of a top-level expression fails we don't try to undo the effects of other parts of the expression.

@StefanKarpinski
Copy link
Sponsor Member

StefanKarpinski commented Dec 20, 2017

One approach to fixing this specific issue would be checking that all references to external values are bound. Of course, any other error while evaluating would still have this problem, but it's a bit better. Seems like a pretty low priority though.

@JeffBezanson
Copy link
Sponsor Member

I'm also not clear on why this particular case is a problem. It should be pretty harmless for foo to be defined, since adding or changing its methods later will work fine.

@djsegal
Copy link
Author

djsegal commented Dec 20, 2017

@Stefan, are you talking about the curlys and ::'s that are sent to funcs as args?


@jeff, But won't you get the redefining warning?

@JeffBezanson
Copy link
Sponsor Member

But won't you get the redefining warning?

Not anymore, no. But even if you did, getting a warning is the least of your problems if your code has an undefined var error.

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

No branches or pull requests

3 participants