Why do we need modules at all? (2011)
Published on: 2025-05-12 07:34:05
Hello Joe,
I've personally wanted an easy way to load modules from different places.
If you started with making modules easy to load from different places,
then later provide support for functions, I imagine this would be easier
to implement immediately and easier for people to make use of immediately
... where "people" refers to me :)
I've got two suggestions (mostly inspired by the Mozilla Framework)...
1. How about letting the programmer choose where the functions come from
(kv store, fs, web-server, etc)...
For instance, a module could start...
-import(["file://misc/collect_int", "http://erlang.org/lists/*",
"mnesia://db1/misc/merge_kv"]).
By default, the code loader would know what to do when it encounters
"file://", "http://", "https://", "ftp://", "sftp://" and "mnesia://" URI
schemes. Programmers could be allowed define their own URI schemes by
providing callbacks for loading code. For instance, one would be able to
define "ubf://" and have the code loader call
... Read full article.