2015-08-30 47 views

回答

20

是和否。的第一个定义自动定义基于模块名称的别名:

defmodule Utilities do 
    defmodule StringUtils do 
    end 

    # Can access the module as StringUtils 
end 

虽然第二:

defmodule Utilities.StringUtils do 
    # Cannot access the module as StringUtils 
end 

其他,通过两者定义的代码和模块是完全一样的。

3

是,两者都精确地转换为符号(在Erlang一个模块被它的符号引用):

:"Elixir.Utilities.StringUtils"

在Erlang中没有真正嵌套的模块,它只是Elixir模拟的东西。

+3

感谢您的回答 - 我想您的意思是“Atom”,当您提到'符号' –