[erlang-questions] Preloaded modules "lists" dependency

Lukas Larsson <>
Mon Feb 17 11:58:18 CET 2014

Hello Loïc,

On Fri, Feb 14, 2014 at 12:01 PM, Loïc Hoguin <> wrote:

> I realize that the lists module has BIFs so perhaps running a VM with a
> changed lists module could create issues. I am not well versed enough to
> know that for sure.

Right now the list of bifs and which modules they are in reside in
$ERL_TOP/erts/emulator/beam/bifs.tab and is statically compiled into the
VM. What happens is that when loading modules that list is checked to see
if a function in that module is a BIF and the big code is linked instead.

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.

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.

On Fri, Feb 14, 2014 at 12:01 PM, Loïc Hoguin <> wrote:

> 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.

PS. Keep in mind that these are my personal opinions. DS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140217/e197ba18/attachment.html>

More information about the erlang-questions mailing list