Skip to content

Small reordering of information in "alias, require, and import" #1684

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

Closed
siiky opened this issue Mar 27, 2023 · 2 comments
Closed

Small reordering of information in "alias, require, and import" #1684

siiky opened this issue Mar 27, 2023 · 2 comments

Comments

@siiky
Copy link
Contributor

siiky commented Mar 27, 2023

Hi,

In the "alias, require, and import" chapter of the Getting Started guide, the order in which macros are referenced is not so natural, as in, why are macros mentioned at all in the sentence "means that ..." ? I think it would be better if the last sentence stating that importing also requires was close to the top, before the other one.

Note that import is lexically scoped too. This means that we can import specific macros or functions inside function definitions:
(...)
importing a module automatically requires it.

Note that `import` is **lexically scoped** too. This means that we can import specific macros or functions inside function definitions:
```elixir
defmodule Math do
def some_function do
import List, only: [duplicate: 2]
duplicate(:ok, 10)
end
end
```
In the example above, the imported `List.duplicate/2` is only visible within that specific function. `duplicate/2` won't be available in any other function in that module (or any other module for that matter). `import`ing a module automatically `require`s it.

@siiky siiky changed the title Small reordering of information Small reordering of information in "alias, require, and import" Mar 27, 2023
@josevalim
Copy link
Member

Can you please send a PR? It will be easier to understand and review the changes. :) Thank you!

@siiky
Copy link
Contributor Author

siiky commented Mar 27, 2023

Thanks for the very quick reply! I don't have all the deps needed to build for now, but if you think the change is worth I'll install later, build, etc, and update the PR.

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

No branches or pull requests

2 participants