【发布时间】:2015-12-06 15:18:23
【问题描述】:
我很难使用 Elixir 语言将一个模块加载到另一个模块中。
例如,我有如下所示的 2 个文件:
a.ex
defmodule A do
def a do
IO.puts "A.a"
end
end
b.ex
defmodule B do
require A
def b do
IO.puts "B.b"
A.a
end
end
B.b
我试图执行 b.ex。然后我得到如下所示的错误:
$elixir b.ex
** (CompileError) b.ex:2: module A is not loaded and could not be found
【问题讨论】:
-
同一目录下有2个文件。 a.ex 和 b.ex
标签: elixir