Trying to figure out why below code is generating warning
defmodule A do
def greet do
IO.puts "Inside A"
end
end
defmodule B do
def greet do
IO.puts "Inside B"
end
end
spawn(A, :greet, [])
Output
iex(14)> c("te.ex")
te.ex:1: redefining module A
te.ex:7: redefining module B
Inside A
[B, A]
It is not related to the spawn
call. :) Every time you compile the file, after the first time, the modules are being redefined because a previous version already existed. There is nothing wrong in this case, the warning is there for the cases you accidentally redefine a module you did not expect to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With