Erlang is getting too big
Tue Oct 14 16:41:34 CEST 2003
On Tue, 14 Oct 2003, Thomas Lindgren wrote:
> > But since auto-recognized BIFs override local
> > definitions (sic!),
> > this would probably break a lot of existing code.
> If you mean BIFs that do not need the erlang: prefix,
> then the override nowadays goes in the other
> direction. (And correctly so, IMO.)
> abs(X) when X > 0 ->
> abs(X) ->
> 1> c(test).
> ... Warning: defining BIF abs/1
Ah, but that warning only tells you that you have defined
a function called abs/1, which is also the name of an
And if you call it from the outside, as in "test:abs(-1)",
your function is called, as you expect.
But if you try to use it for a local call, you get into
trouble, because it is overridden by the BIF:
abs(X) when X > 0 ->
./test.erl:7: Warning: defining BIF abs/1
(And no, the ordering of the functions above does not matter.)
Is this sufficiently confusing?
Richard Carlsson (richardc@REDACTED) (This space intentionally left blank.)
E-mail: Richard.Carlsson@REDACTED WWW: http://user.it.uu.se/~richardc/
"Having users is like optimization: the wise course is to delay it."
-- Paul Graham
More information about the erlang-questions