lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

> > I am afraid we will exaust this "global namespace of library names"
> > pretty soon.
>
> Not likely; the space of short ASCII strings is gigantic.  E.g. most
> of the sites on the web are under .com, .net or .org, and new names
> get registered every day.  Other examples of usable big flat
> namespaces:
>
> * unix executable names
>
> * C library
>
> * phone directory

Except for the C library, these are all hierarchical.  Prefixing lua_ in
all Lua functions is an example of hierarchy. That is what I meant. My
library has many modules, including modules with names that are too
common and it would be mean if I reserved them, such as "url", and
"mime". Someone prefixed my name to the thing. Feels weird to see people
loading *me*,  but might be a good solution. :o)

I guess what I meant is that the name of the library should have
some structure that minimized colisions. The namespace, though, should
just be returned by "require", and the user can assign it to whatever he
likes, including a table hierarchy. Library implementations shouldn't
have to worry about it.

    local socket = require"diego.socket"
    local http = require"diego.http"

or

    local socket = require"diego.socket"
    socket.http = require"diego.http"

Doesn't matter. But if your experience shows that this is a non-issue, I
am happy to drop my name from the thing. I just hope people don't come
up with a much better "url" module and curse me for reserving the name.
I wanted really hard to use the name "net" and it wasn't available at the
time. Hmmm, maybe I should grab it now! :o)

[]s,
Diego.