[erlang-questions] Why do we need modules at all?

Dmitrii Dimandt dmitrii@REDACTED
Tue May 24 10:39:06 CEST 2011


> 
> So I imagine:
> 
>     1) all functions have unique names
>     2) there are no modules
>     3) we discover the name of a function by searching metadata
>        describing the function in a database
>     4) all public functions (think open source) are in the same
>        database
> 
> We could make a system to do this.

Hm... you'd still need *some* kind of modules.

For instance, in Webmachine each resource is expected to have some, or all, of predefined public/exported functions: to_html, resource_exists, allowed_methods etc.

So, each resource will have functions with the same name. If we move all functions to a global namespace, then how do we differentiate between these functions? Probably by naming them resource_name_function_name?

Furthermore, what do we do with behaviours? A behaviour is encapsulated within a module, also with a predefined set of exported funcions (and any number of custom exported functions).


More information about the erlang-questions mailing list