[erlang-bugs] Undetected undefined remote function calls

Loïc Hoguin <>
Tue Dec 18 16:58:17 CET 2012


All true, but warnings are there to inform the developer that what he's 
doing is probably wrong. Not all warnings are caused by actual errors 
(like not using a defined variable). Doing foo:bar() from foo has very 
little chances of being done on purpose if bar isn't defined. Setting a 
warning for this does make sense.

Of course as with all other warnings you should be able to disable it if 
you actually need to do something like this.

On 12/18/2012 04:48 PM, Robert Virding wrote:
> To clarify myself:
>
> Calling foo:bar() is doing an intermodule call in which case detecting whether the function exists or not is left to run-time and it is irrelevant which module it is.
>
> Robert
>
> ----- Original Message -----
>> From: "Robert Virding" <>
>> To: "Kostis Sagonas" <>
>> Cc: "erlang-bugs" <>
>> Sent: Tuesday, 18 December, 2012 4:21:16 PM
>> Subject: Re: [erlang-bugs] Undetected undefined remote function calls
>>
>> 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" <>
>>> To: "erlang-bugs" <>
>>> 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
>>> 
>>> http://erlang.org/mailman/listinfo/erlang-bugs
>>>
>> _______________________________________________
>> erlang-bugs mailing list
>> 
>> http://erlang.org/mailman/listinfo/erlang-bugs
>>
> _______________________________________________
> erlang-bugs mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-bugs
>


-- 
Loïc Hoguin
Erlang Cowboy
Nine Nines
http://ninenines.eu


More information about the erlang-bugs mailing list