Skip to content

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

Closed
@siiky

Description

@siiky

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions