如果一个模块import是多个其他模块,那么给定函数的来源可能并不明显.例如:
defmodule Aimable do
import Camera
import Gun
def trigger do
shoot # which import brought it in?
end
end
Run Code Online (Sandbox Code Playgroud)
我知道有办法最大限度地减少这种混乱:良好的命名,专注的模块,有针对性的导入等import Gun, only: [:shoot].
但是,如果我遇到这样的代码,有没有办法检查Aimable并查看函数的来源shoot?
elixir ×1