lua-users home
lua-l archive

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


2016-02-28 1:02 GMT+02:00 Sean Conner <sean@conman.org>:
> 2) But it does mean that when I'm doing a heavy POSIX program, it's a lot
> of:
>
>         local process = require "org.conman.process" -- fork(), etc
>         local signal  = require "org.conman.signal"  -- signals
>         local getopt  = require "org.conman.getopt"  -- parse command line
>         local syslog  = require "org.conman.syslog"  -- syslog
>         local errno   = require "org.conman.errno"   -- defines for errors
>         local fsys    = require "org.conman.fsys"    -- file system calls
>         local net     = require "org.conman.net"     -- network code
>         local sys     = require "org.conman.sys"     -- um ... [2]

This can obviously be done in a loop, or by a single function call
    import"process signal getopt syslog errno fsys net sys"
 if you did not 'local' all those names. After all, you are probably
going to follow all that with `local fork = process.fork` etc for the
particular functions you actually need.

I wonder if the dogma of "Don't pollute the global namespace"
is not being clung to too religiously. In this sort of situation, where
the names are those of near-standard libraries (at least within
conman.org), I think there is something to be said for keeping them
in _ENV.