Navigation Menu

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

Raise before expansion when outside of a function and the function/arity does not exist #2387

Closed
josevalim opened this issue Jun 9, 2014 · 3 comments

Comments

@josevalim
Copy link
Member

For example, the following code:

module Foo do
  @foo "bar"
end

Should raise with unknown function or macro module/2.

@sasa1977
Copy link
Contributor

sasa1977 commented Jun 9, 2014

I was thinking some more about it and just wanted to mention that this seems like a very special case.

For example, if we have

my_macro do
  module Foo do @foo "bar"
end

Then you can't tell for sure if module is available or not until you expand my_macro. Just wanted to mention, I don't know if you already thought of this case.

@josevalim
Copy link
Member Author

Yes, exactly. But there is no reason to expand module/2 if my_macro/1 is not available. :)

@josevalim josevalim added this to the 1.0 milestone Jun 30, 2014
@josevalim josevalim changed the title Raise before expansion when outside of a function and the function/a does not exit Raise before expansion when outside of a function and the function/arity does not exist Jul 1, 2014
@josevalim
Copy link
Member Author

@sasa1977 now I understood your comment. We are not going special case module, it is a mechanism available for all calls that cannot expand to a local call (basically all calls outside a function/macro).

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

No branches or pull requests

2 participants