繁体   English   中英

elixir:eval_forms 和 compile in elixir_compiler 的区别

[英]Difference between elixir:eval_forms and compile in elixir_compiler

elixir_compiler.erl (和其他一些地方)中,代码的编译以两种不同的方式完成。 以下代码在两者之间切换:

 eval_forms(Forms, Args, E) ->
  case (?key(E, module) == nil) andalso allows_fast_compilation(Forms) of
    true  ->
      {Result, _Binding, EE} = elixir:eval_forms(Forms, [], E),
      {Result, EE};
    false ->
      compile(Forms, Args, E)
  end.

据我所知,一个通过构建编译模块并执行“编译函数”来编译代码,另一个使用erl_eval模块,它是某种解释器。 我想知道的是为什么有两种不同的代码编译方式以及如何选择方式。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM