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

Joe Armstrong erlang@REDACTED
Tue May 24 14:53:18 CEST 2011


On Tue, May 24, 2011 at 2:05 PM, Tim Watson <watson.timothy@REDACTED>wrote:

> > But plain module namespace is also ok. It would be impossible for me
> > to work with 30K LOC with plain function namespace.
>
> I think what Joe is getting at - he'll correct me if I'm wrong about
> this - is to refer to functions not only by name, but by other
> metadata as well. I'm not sure what this looks like empirically, as
> like you I can't see how using only function names you could work with
> a flat namespace. Looking up functions by other (additional) metadata
> such as type signature, author, date, company, category (mutiples?),
> pre/post conditions, safe guarantees, etc - that would work. In fact
> if you think about a process engine (such as BPMS solutions and the
> like) then process (i.e., function) is often selected dynamically
> based on many attributes, not just name.
>

Yes - how this would work I don't know - my Haskell friends say that
searching for
function by type signatures is good.

What do I do today when I suspect that somebody has written some code ?


    1) will it take me < ten minutes to write the code?
        yes - write it
    2) google or ask a friend
    3) this gets me to git or sowhere
    4) search
    5) cut-and-paste

Not a good method - and this is *best practise*



>
> Just how this will work in practise as a replacement for existing
> (shall we say normal) way of referring to a function that is in a
> module, I could not say. But it is an interesting concept. Perhaps
> using a URI as the name and thereby being able to have multiple URIs
> representing the various different category-based paths to identify
> the function - the "aliases" could then redirect to the direct,
> uniquely named resource which would in turn return the function
> metadata (and binary code presumably).
>

Something like this.

Actually for development it would be great to say

    -import("http://a.b.c/modname", [foo/2]).

this would just make an rcp to foo/2 on the remote host and save all the
pain of locally installing
the necessary code on my machine.

/Joe




> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110524/9733ac3f/attachment.htm>


More information about the erlang-questions mailing list