[erlang-bugs] Undetected undefined remote function calls

Robert Virding robert.virding@REDACTED
Tue Dec 18 16:21:16 CET 2012


Not really. You are making a fully qualified "external" call to a function in another module, which in this case happens to be the same module, and the function's existence is checked at run-time. Even if the function existed when you make the call you would not make an internal jump but go through the modules exported function table. Calling function foo/1 in the same module behaves differently if you call it foo(5) or if you call it module:foo(5). So in that sense it does make perfect sense to NOT complain about an undefined function.

It is similar to the difference in doing exit(boom) and exist(self(), boom).

Robert

----- Original Message -----
> From: "Kostis Sagonas" <kostis@REDACTED>
> To: "erlang-bugs" <erlang-bugs@REDACTED>
> Sent: Monday, 17 December, 2012 11:48:58 AM
> Subject: [erlang-bugs] Undetected undefined remote function calls
> 
> Shouldn't the compiler be complaining that the module below contains
> an
> undefined function?  (*)
> 
> %%===================
> -module(foo).
> -export([test/0]).
> 
> test() ->
>    foo:bar().
> %%===================
> 
> Kostis
> 
> (*) Or is this treated as a call to a "future" version of the module?
> :P
> _______________________________________________
> erlang-bugs mailing list
> erlang-bugs@REDACTED
> http://erlang.org/mailman/listinfo/erlang-bugs
> 



More information about the erlang-bugs mailing list