lua-users home
lua-l archive

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


On Mon, 16 Oct 2006 14:41:57 -0700
Mark Edgar <medgar@student.gc.maricopa.edu> wrote:

> George wrote:
> > Btw, I'd like to ask if there's a compelling reason why these posix
> > functions have their own namespace, why not simply extend the existing
> > "os" table?
> 
> The "extension" API is available too.
> 
> http://lua-users.org/wiki/ExtensionProposal

This looks good. But I must say that I agree with the comments at
the end of the page. Instead of extending current "os" and instead of
having a general "ex" module, why not split the up in categories:

env.getenv(name)
env.setenv(name, value)
env.unsetenv(name)
env.environ()

fs.chdir(pathname)
fs.mkdir(pathname)
fs.currentdir()
fs.dir(pathname)
fs.dirent(pathname)
fs.lock(file, mode, offset, length)
fs.unlock(file, offset, length)

ps.pipe()
ps.sleep(seconds)
ps.spawn(...)
ps.wait(proc)

> It is not meant to provide access to POSIX, but instead to provide a
> layer of functionality beyond what standard C provides, but which modern
> desktop (and other) operating systems provide anyway.  This includes
> hierarchical filesystem support, modifying the environment, file
> locking, pipes, and process control.
> 
> If you are specifically aiming only at POSIX, then this probably isn't
> the library for you.  If instead you are aiming to write Lua programs
> which are portable to POSIX and Window systems, then you may find this
> library quite useful.

We could add some posix specific things too into "posix" or "pos"
namespace, or...

We could just have them documented as "unimplemented" on windows.
Things like link and symlink.

--
Natanael Copa