[erlang-questions] Preloaded modules "lists" dependency

Loïc Hoguin essen@REDACTED
Fri Feb 14 12:01:15 CET 2014


Hello,

Following the off topic of the name thread I have a small question for 
the OTP team.

It came out that the only modules required to run Erlang "from scratch" 
are lists and error_logger. The latter is perfectly understandable and 
not a problem.

On the other hand it could be a good idea to remove the dependency on 
the lists module.

I have been experimenting on and off about running the VM naked. Use 
cases include using it for a new language "Erlang2/OTP2" (not just a new 
syntax but also a new lib), using it as bare as possible for command 
line tools, or using it for other kinds of environments, embedded or 
other. Personally I would be interested in trying out creating a 
dedicated framework for writing games using SDL and Erlang in my spare time.

In these cases, the lists dependency may be considered harmful. It's 
especially true when you want to create "Erlang2/OTP2" as you might want 
to try to simplify or improve the interface.

For example in a framework dedicated to games the lists module could 
automatically parallelize processing across all the cores if the list is 
larger than a certain threshold.

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.

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.

If that's something the OTP team would be okay to look at I am willing 
to try and make the patch.

It may not sound very useful at first, but realize this would give 
people a clean canvas, which is essential for experimentation.

-- 
Loïc Hoguin
http://ninenines.eu



More information about the erlang-questions mailing list