[erlang-questions] lists:reverse/1 as a built-in function

Thomas Lindgren <>
Tue Jan 16 11:25:13 CET 2007


--- Robert Baruch <> wrote:

> Personally, I'd like to decouple the "BIF problem"
> from the "import  
> problem", like this:
> 
> 
> Use Java-like package rules in Erlang, applied like
> this: /.../

First of all, I'd recommend you have a look at
Erlang's packages, which are fairly Java-inspired, as
far as I know.

> If you call example_function(Arg) anywhere else, you
> need to either  
> call it as foo.bar.baz:example_function(Arg), or you
> need to -import 
> (foo.bar), and then you must call it as
> baz:example_function(Arg).

What if example_function/1 is imported into module m
and also is defined in m? If I (locally, in m) call
example_function(1), which function would this
proposal invoke?

For example:

-module(m).
-compile(export_all).
%% f/1 is auto-imported

f(1) -> ok.

g(X) -> f(X). %% which f/1 is called?

So far, we have two proposals:
- the auto-imported function is invoked (current
compiler)
- the local function is invoked (proper scoping)

> The reason that I call baz the "class" name /.../

Not to sound too bad-tempered, but please don't do
that :-) The Java terminology doesn't quite
transplant, so it's liable to just be confusing.

> /.../ That is, a BIF  
> is treated no differently from any other function
> when it comes to name qualification.

I agree with this part, which I call "proper scoping"
above.

Best,
Thomas



 
____________________________________________________________________________________
Sucker-punch spam with award-winning protection. 
Try the free Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/features_spam.html



More information about the erlang-questions mailing list