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

Cannot define isempty in Main #41656

Closed
bicycle1885 opened this issue Jul 20, 2021 · 3 comments · Fixed by #41752
Closed

Cannot define isempty in Main #41656

bicycle1885 opened this issue Jul 20, 2021 · 3 comments · Fixed by #41752
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@bicycle1885
Copy link
Member

I found a confusing behavior when I tried to define a function named isempty in the Main module:

julia> isempty(x) = true
ERROR: error in method definition: function Base.isempty must be explicitly imported to be extended
Stacktrace:
 [1] top-level scope
   @ none:0
 [2] top-level scope
   @ REPL[1]:1
@KristofferC
Copy link
Sponsor Member

KristofferC commented Jul 20, 2021

Probably from

if isempty(Base.ARGS) || Base.ARGS[1] !== "0"

enough to change to Base.isempty?

@StefanKarpinski
Copy link
Sponsor Member

Would it make sense to wrap that whole logic in an anonymous module instead? Prefixing everything with base seems annoying.

@KristofferC
Copy link
Sponsor Member

Most of it is already in an anonymous function so

@eval Module() begin
could probably just be moved up a few lines as well.

@JeffBezanson JeffBezanson added the bug Indicates an unexpected problem or unintended behavior label Jul 21, 2021
bicycle1885 added a commit to bicycle1885/julia that referenced this issue Aug 2, 2021
KristofferC pushed a commit that referenced this issue Aug 2, 2021
KristofferC pushed a commit that referenced this issue Aug 2, 2021
KristofferC pushed a commit that referenced this issue Aug 25, 2021
KristofferC pushed a commit that referenced this issue Aug 31, 2021
KristofferC pushed a commit that referenced this issue Sep 3, 2021
staticfloat pushed a commit that referenced this issue Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants