When running code inside IEx, is it compiled or evaluated?

defmodule Hello do
  def world, do: IO.puts("Hello World")
end

When running the code in IEx by copy and pasting it to IEx or just running iex filename.exs , is it compiled first or just directly evaluated? If it is compiled, what does that mean? Compiled to bytecode or BEAM ???

It is compiled in memory to BEAM bytecode.

3 Likes

you are right. An OS process for BEAM instance is started when I call iex. It then checks for the function/ module in the memory. If it does not find it in the memory then it will search for the bytecode on the disk