r(module_name)没有在iex中重新加载@doc

Dav*_*oss 0 elixir reload iex

我在iex>中更新我的@doc以测试它的外观.我遇到的问题是我必须退出iex才能查看更新的@doc文档.有没有办法在使用r()时重新加载模块@doc变量?

iex -S mix 
iex> h Coordinate.island/1 
      ## Examples 
      iex> {:ok, coord } = Cordinate.start_link
         Cordinate.island(coord) 
         :falls_town
Run Code Online (Sandbox Code Playgroud)

更新@doc以返回:none而不是:falls_town并保存文件.

iex> r(Coordinate) 
iex> h Coordinate.island/1 
   # issue: still showing the old @doc example 
   ## Examples 
   iex> {:ok, coord } = Cordinate.start_link
        Cordinate.island(coord) 
        :falls_town # should be :none 
Run Code Online (Sandbox Code Playgroud)

Dog*_*ert 5

h/1目前从已编译的.beam文件加载文档.r/1编译内存中的文件并且不会将.beam文件写入磁盘,这意味着h/1在运行时不会重新加载文档r/1:

当我们在IEx中重新加载模块时,我们重新编译模块源代码,在内存中更新其内容.磁盘中的原始.beam文件,可能是模块的第一个定义来自的文件,根本不会改变.

资源

你可以编译打包,并通过运行程序将最终.beam文件到硬盘recompile/0iex(而不是r/1).运行之后,您应该看到新的文档h/1.