[erlang-questions] Preloaded modules "lists" dependency

Loïc Hoguin essen@REDACTED
Mon Feb 17 14:40:45 CET 2014

On 02/17/2014 11:58 AM, Lukas Larsson wrote:
> So if you want to change the lists (or ets for that matter) module you
> would have to create a solution for either in compile time removing those
> bifs or possibly figuring it out in runtime.

Why not have this information as an attribute of the module itself?

> It should be possible to do in a separate fork of Erlang/OTP to start with
> and if it proves to be generally useful I don't see why it wouldn't be
> possible to bring it upstream.

This is probably a bit too complicated for me right now, compared to 
just working around it, but if I ever want to dig deep into the VM I'll 
remember it.

One question though. What happens if I define a function that is 
implemented as a BIF (that is, for example, create an Erlang version of 
lists:keymember/3 in the lists source code), is it replaced with the BIF 
on load?

>> Any chance of having that dependency removed eventually? There are 13
>> occurrences of lists: in the preloaded modules. The functions used are
>> keyreplace, member, reverse, foldl, foreach. The first 3 are BIFs, the
>> other 2 aren't. Perhaps the first 3 could also be available from a
>> prim_lists module and the other two inlined? This way the VM doesn't
>> require any additional module to run, except of course error_logger but
>> that's only a requirement when you want to extend the basic functionality.
> This is something that would be a lot easier to do and less complicated to
> make it into upstream. As long as there are tests that make sure nothing is
> broken over time.

Gotcha. Sounds like a good plan for a future week-end.

Loïc Hoguin

More information about the erlang-questions mailing list