[erlang-questions] What are BIFs?
Wed Oct 7 18:55:10 CEST 2009
2009/10/6 Masklinn <masklinn@REDACTED>
> On 6 Oct 2009, at 00:11 , Robert Virding wrote:
>> There has always been much confusion about what a BIF really is, how they
>> relate to the Erlang language. An example of this was a discussion earlier
>> this year when someone wanted to have some more functions in lists coded
>> C and so become part of Erlang. Saying that they are functions coded in C
>> just tell us how they are implemented not what they *are*.
> You might want to check out how Python's documentation/spec handles the
> similar concept of "builtin functions" (which actually aren't all functions,
> some are type constructors but in python constructors and functions are used
> the same way so…). Python's builtin functions are core functions existing in
> the "default" namespace (and therefore always available without the need to
> prefix them with a namespace qualifier).
Yes, I think the way it is done today in Erlang is ok: having them both
explicitly in the module erlang and being able to use them without a module
name. I think the problem is that the module erlang is a mix of "core"
erlang language functions and run-time functions which aren't really part of
the language. Then you have the added confusion of for some you don't need
to qualify them with a module name and some you do.
The solution is *NOT* to just remove the need for module name for all
What I would like to do is make the module erlang only consist core erlang
language functions which are part of the erlang language. These functions
you can use without the explicit module name. All other functions, what I
call run-time functions, should be moved out of erlang into another
module/modules. This would have the benefit of clearly defining which
functions are part of the language and have a module structure which
N.B. This separates which are the core functions from how they are
implemented, there is no requirement that they are implemented in C.
Jonas Barklund and I were also working with the idea that their could be a
number of core language modules, not just erlang, containing the core
functions. It would certainly make the modules smaller and more managable
but I don't know if it is necessary.
More information about the erlang-questions