Elixir Getting Started Guide Section for `use`

44 views
Skip to first unread message

Razvan Musetescu

unread,
Nov 22, 2016, 6:54:32 PM11/22/16
to elixir-lang-core
I've been trying to figure out the best way to leverage the functionality of module into other modules.
Naturally I thought that one of the directives require or import or the use macro would be the solution

After doing some research I found that the use macro solved my problem but I figured out how to use it just after reading this

Specifically there's nothing in the Getting Started Guide about how should we should write the __using__ macro.
I believe this information should be available in the guide as the current documentation isn't enough for a beginner to start using module that he himself wrote.

Ben Wilson

unread,
Nov 22, 2016, 11:02:22 PM11/22/16
to elixir-lang-core
The documentation is pretty thorough here: http://elixir-lang.org/docs/master/elixir/Kernel.html#use/2

Honestly, use isn't really beginner material. What do you mean by "start using module that he himself wrote" ?

Louis Pilfold

unread,
Nov 23, 2016, 3:13:33 AM11/23/16
to elixir-lang-core
None of require, import, and use are needed to call functions from another module. You just type MyModule.my_function()

I would say that using import is generally a bad idea as it becomes harder to keep track of which functions are defined in which modules.

Cheers,
Louis


--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/be4c95d6-0f82-4bb7-928b-d1b33392205a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages