Erlang is getting too big

Thomas Lindgren thomasl_erlang@REDACTED
Tue Oct 14 21:12:16 CEST 2003


--- Richard Carlsson <richardc@REDACTED> wrote:
> 
> 
> 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.)
> >
> > -module(test).
> > -compile(export_all).
> >
> > abs(X) when X > 0 ->
> >    X;
> > abs(X) ->
> >    -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
> auto-recognized BIF.
> 
> 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:

As the saying goes, I stand corrected. (Thanks also to
Dan G for pointing this out.) 

So, um, well, *shouldn't* a local call really go to
the local version too? I think it should.

Again, I would suggest sailing through the transition
period with a linter. E.g., emit warnings or even
errors when finding a call which is ambiguous in this
respect. (The linter probably should do that anyway.)

Best,
Thomas


__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com



More information about the erlang-questions mailing list