There is a very similar discussion on this topic a couple days ago. I also remember we discussed it in the past. Can you please try looking up in the archives and let us know if you found it?
On Friday, May 6, 2016, Myron Marston <[email protected]> wrote: > Given the following module definition: > > defmodule MyMod do > def fun_1 do > 0 > end > > def fun_2 do > fon_1 + 1 > endend > > …Elixir provides a nice compile-time error informing me that MyMod.fon_1/1 > does not exist: > > ** (CompileError) test/foo_test.exs:7: undefined function fon_1/0 > (stdlib) lists.erl:1337: :lists.foreach/2 > (stdlib) erl_eval.erl:669: :erl_eval.do_apply/6 > (stdlib) erl_eval.erl:122: :erl_eval.exprs/5 > > But if I call an undefined remote function: > > defmodule MyMod do > def fun_1 do > 0 > end > > def fun_2 do > MyMod.fon_1 + 1 > endend > > …then Elixir does not provide a compile-time error. Instead, a runtime > error is raised when fun_2 is called: > > ** (UndefinedFunctionError) undefined function MyMod.fon_1/0 > stacktrace: > MyMod.fon_1() > test/foo_test.exs:7: MyMod.fun_2/0 > test/foo_test.exs:15 > > Is there anything preventing Elixir from providing a compile-time error in > this case? Obviously, if a remote function call is made using a module > variable (e.g. var.foo()) the compiler can’t statically know what > functions var exports. But if the remote function call is made on a > static alias, it seems like the compiler should be able to figure it out. > > Thanks, > Mron > > > -- > You received this message because you are subscribed to the Google Groups > "elixir-lang-core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <javascript:_e(%7B%7D,'cvml','elixir-lang-core%[email protected]');> > . > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/CADUxQmtuLSokWRJA0prd9bnguSepcYL6fyFWcTA%3Dw%2BntNYn88A%40mail.gmail.com > <https://groups.google.com/d/msgid/elixir-lang-core/CADUxQmtuLSokWRJA0prd9bnguSepcYL6fyFWcTA%3Dw%2BntNYn88A%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- *José Valim* www.plataformatec.com.br Skype: jv.ptec Founder and Director of R&D -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4%2B_kB%2BpBJNviaze9qmL_yKkg59D7kzrZ17jwRDRrp6%2Bzw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
