[erlang-questions] lists:reverse/1 as a built-in function
Robert Baruch
autophile@REDACTED
Tue Jan 16 19:28:55 CET 2007
On Jan 16, 2007, at 12:25 PM, Thomas Lindgren wrote:
> So, to recapitulate: example_function is locally
> defined and also imported.
>
(...)
> 2. If example_function is auto-imported, we get a
> compiler warning, and the call will invoke the BIF,
> not the local function. (The name clash is resolved
> "the wrong way")
>
> Example:
> -module(test).
> -compile(export_all).
>
> f(X) -> element(1,X).
> element(A,X) -> X.
>
> (Try test:f({a}).)
>
Actually, I think I had envisioned the BIF not being invoked, but
rather the local function.
In any case, at least there's a warning -- and if it's a warning,
then no matter which way you resolve it, there's a chance the
resolution didn't read the programmer's mind properly :) If you
really want strict (maybe it could be a compiler option), then this
would be an error.
--Rob
More information about the erlang-questions
mailing list