Skip to content

Conversation

weppos
Copy link
Contributor

@weppos weppos commented Oct 13, 2015

I was reading the "Getting started" guide and one of the things I noticed is that the section where require, alias and import are documented doesn't include any explanation for use. In fact, use is not mentioned at all in the entire getting started guide.

I know import, require and alias are SpecialForm whereas use is defined as Kernel macro, however it's not uncommon to see new users confused by this specific keyword: see here and here.

This branch takes bits and pieces from the answers above and the use/2 documentation, and adds a new section in the "getting started" to explain the purpose of use.

What do you think?

@josevalim
Copy link
Member

THank you! @weppos the issue is that use is not necessarily lexically scoped as everything else. So maybe we could add this to the end of the chapter and start with something like you described: "Although not a directive, use is a macro tightly related to require, after all [current description]". What do you think?

@weppos
Copy link
Contributor Author

weppos commented Oct 14, 2015

Fine for me. Changing it now.

@weppos
Copy link
Contributor Author

weppos commented Oct 14, 2015

Done. Give it a look and let me know if it works for you.

@@ -118,6 +118,7 @@ In the example above, the imported `List.duplicate/2` is only visible within tha

Note that `import`ing a module automatically `require`s it.


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was probably added in the cut&paste. Removing it...

@josevalim
Copy link
Member

I have added two more comments and we are good to go. :)

@weppos
Copy link
Contributor Author

weppos commented Oct 14, 2015

Here we go. Thanks for your feedback.

josevalim added a commit that referenced this pull request Oct 14, 2015
Add a short documentation for `use`
@josevalim josevalim merged commit b21f881 into elixir-lang:master Oct 14, 2015
@josevalim
Copy link
Member

❤️ 💚 💙 💛 💜

@weppos weppos deleted the use branch October 14, 2015 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants