You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
defmoduleMathdo
defsome_functiondo
importList, 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.
The text was updated successfully, but these errors were encountered:
siiky
changed the title
Small reordering of information
Small reordering of information in "alias, require, and import"
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.
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.
elixir-lang.github.com/getting-started/alias-require-and-import.markdown
Lines 106 to 117 in 86b983f
The text was updated successfully, but these errors were encountered: