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

Michael Truog mjtruog@REDACTED
Wed May 25 09:25:48 CEST 2011


On 05/24/2011 11:33 PM, Richard O'Keefe wrote:
> On 25/05/2011, at 12:45 AM, Joe Armstrong wrote:
>>
>> On Tue, May 24, 2011 at 1:56 PM, Max Lapshin <max.lapshin@REDACTED> wrote:
>> Very strange topic for me.
>>
>> I'd like to know if there will be hierarchial modules in Erlang,
>> because tree of packages is a rather good idea:
>>
>> No it's not - this has been the subject of long and heated discussion and is
>> why packages are NOT in Erlang - many people - myself included - dislike
>> the idea of hierarchical namespaces. The *dot* in the name has no semantics
>> it's just a separator. The name could equally well be encoders.mpg.erlyvideo
>> or mpg.applications.erlvideo.encoder - there is no logical way to organise the
>> package name and it does not scale -
> I should point out that Haskell has dotted names,
> uses them to indicate semantics,
> and has a *managed* hierarchical name space;
> Data.* and Control.* and Net.* and so on are
> tolerably clear.
>
> I should also admit that there are occasional complaints
> about it not being clear where things have been put, and
> other indexing and searching tools are often used to find
> things.
Anthropologists supposedly think that wanting a taxonomy is very natural (http://en.wikipedia.org/wiki/Taxonomy#Taxonomy_and_mental_classification).  A hierarchy may not be formed in a way that everyone would expect because we lack a collective mind.  However, I think that source code requires organization to be manageable.  To make a hierarchy flexible, pointers could be used to represent different interpretations of what the hierarchy could be.

If a large collaborative effort was formed to generate source code, it is important that code is reused to reduce complexity.  A hierarchy would be our most natural way of determining source code that can be referenced to build larger systems, and that would make the dependency more likely to receive maintenance.  That would helps us avoid the current situation with things like jungerl.  I don't think it is important whether we use a '.' character or a '_' character to create a hierarchy with the names in our source code.  However, the '.' character used by the undocumented Erlang package functionality could be used to provide better support for unmanageable hierarchies, perhaps with search and documentation benefits.

The other part to imposing order on a large collaborative effort seems to be determining the quality of the code for reuse.  A rating system could be used and doesn't require a hierarchy.  However, with many different common segments of source code available, a hierarchy can provide a way of focusing on relevant source code and should promote code reuse.




More information about the erlang-questions mailing list