Skip to content

Commit

Permalink
Addressed PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Eumir Gaspar committed Mar 8, 2017
1 parent 77fad36 commit 73d3c43
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -774,29 +774,28 @@ Translations of the guide are available in the following languages:
end
```

* <a name="avoid-repeating-aliased-module-names"></a>
If you plan to alias your modules, avoid using the same name consecutively.
* <a name="avoid-repeating-aliased-module-fragments"></a>
If you plan to alias your modules, avoid using the same fragment consecutively.
This avoids any problems with [Conflicting Aliases]
for the module.
<sup>[[link](#avoid-repeating-aliased-module-names)]</sup>
<sup>[[link](#avoid-repeating-aliased-module-fragments)]</sup>

```elixir
# not preferred

defmodule Todo.Todo do
alias Todo.Todo
...
end

# somewhat preferred

defmodule Todo.Models.Todo do
alias Todo.Models.Todo
defmodule AnotherModule do
alias Todo.Todo
# here it is ambigious to which one we refer when we call `Todo`
end

# preferred

defmodule Todo.List do
alias Todo.List
...
# Basically, you should consider a better name for your module
# if you ever find yourself duplicating fragments.
end
```

Expand Down Expand Up @@ -1150,7 +1149,7 @@ project.
[Chinese Traditional]: https://github.com/elixirtw/elixir_style_guide/blob/master/README_zhTW.md
[Code Analysis]: https://github.com/h4cc/awesome-elixir#code-analysis
[Code Of Conduct]: https://github.com/christopheradams/elixir_style_guide/blob/master/CODE_OF_CONDUCT.md
[Conflicting Aliases]: https://elixirforum.com/t/using-aliases-for-fubar-fubar-named-module/1723/3
[Conflicting Aliases]: https://elixirforum.com/t/using-aliases-for-fubar-fubar-named-module/1723
[Contributing]: https://github.com/elixir-lang/elixir/blob/master/CODE_OF_CONDUCT.md
[Contributors]: https://github.com/christopheradams/elixir_style_guide/graphs/contributors
[Elixir Style Guide]: https://github.com/christopheradams/elixir_style_guide
Expand Down

0 comments on commit 73d3c43

Please sign in to comment.