lua-users home
lua-l archive

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


Luiz wrote:
> - Providing a POSIX binding for Lua is a large task because POSIX is a huge
>   standard. Moreover, it is not clear whether providing a thin binding
>   (that is, too close to the POSIX API) is useful. A slightly higher-level
>   binding is probably best suited to Lua. In particular, combining several
>   services into one Lua function usually works best (for instance, there
>   is no need for setenv and unsetenv; setenv(name,nil) works fine as unsetenv.)

Surely the environment would be represented by a Lua table.

> - The recent discussion brought an important point: we do not need a full
>   POSIX library; we need a simple abstraction for common OS services. The
>   "ex" API is one good example of that [1]. So is LuaFileSystem [2].
>   The point is not that it is difficult to bind POSIX to Lua; it is not.
>   The point is that we need cross-platform access to common OS services.

A thin binding to POSIX (and to whatever equivalent functionality on
Windows) is useful.  On top of such bindings you can write your
cross-platform, native-feeling library in Lua itself.  This is a common
pattern.  For example, often a tool like SWIG is used to bind a C
library to a scripting language (the tedious part), and then a natural
API meant for the user is written on top of that in the scripting
language (the fun part).

--John