[erlang-bugs] Undetected undefined remote function calls
Mon Dec 17 12:42:45 CET 2012
Well, in the context of code loading, it is certainly possible, although more than a little weird. :)
The function sys:do_change_code/5 in OTP stdlib specifically relies on calling a function in the newly loaded version of a module, with data from the old version. It is of course calling a function that is well understood in advance, but this is only by convention, and not easily checkable*.
Let's say the presence of the exported function bar() indicates that a certain feature is supported, and the function looks like this:
case erlang:function_exported(foo, bar, 0) of
true -> foo:bar();
false -> ok
Should the compiler still warn?
(I'm open to the answer "yes". I don't think the above is a good solution).
* It's of course easy if both versions of the module are available for analysis, but they seldom are in practice.
On 17 Dec 2012, at 11:48, Kostis Sagonas wrote:
> Shouldn't the compiler be complaining that the module below contains an undefined function? (*)
> test() ->
> (*) Or is this treated as a call to a "future" version of the module? :P
> erlang-bugs mailing list
Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.
More information about the erlang-bugs