[erlang-questions] Overriding built-in functions in a module
Richard O'Keefe
ok@REDACTED
Fri Jun 4 07:18:58 CEST 2010
On Jun 4, 2010, at 3:39 PM, Igor Ribeiro Sucupira wrote:
> On Thu, Jun 3, 2010 at 10:00 PM, Richard O'Keefe <ok@REDACTED> wrote:
>>
>> So let's do what the first error message says:
>>
>> * 4 bar() -> ?MODULE:spawn(fun (X) -> X+1 end).
>>
>> m% erlc foo.erl
>> ./foo.erl:6: Warning: defining BIF spawn/1
>> ./foo.erl:6: Warning: function spawn/1 is unused
>>
>> There's an explicit call there, how can it not be used?
>
>
> This was a little bit unrelated to the topic. Given that you can't
> call a non-exported function with that syntax, that code is certainly
> not calling the local fun spawn/1, since it's not exported.
Note that I wasn't suggesting that the call should be *allowed*,
only that it is *there*. There's a big difference between
"there are NO calls to this function" and
"the calls to this function won't be allowed at run time because
the function is not exported."
In short, I am not quarreling with the decision to report an
error here, only commenting that the error message is extremely
misleading.
More information about the erlang-questions
mailing list