[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Literal mimicking of C APIs in Lua (split from Re: [ANN] luaposix 33.3.0 released)
- From: "Gary V. Vaughan" <gary@...>
- Date: Sun, 1 Mar 2015 09:02:00 +0000
Hi Sean,
> On Mar 1, 2015, at 4:16 AM, Sean Conner <sean@conman.org> wrote:
>
> It was thus said that the Great Gary V. Vaughan once stated:
>> A library binding various POSIX APIs, including curses. POSIX is the IEEE
>> Portable Operating System Interface standard. luaposix is based on lposix
>> and lcurses.
>>
>> I am happy to announce release 33.3.0 of luaposix.
>
> This isn't about luaposix per se, but this is prompting this observation
> about Lua wrappers for C APIs: they tend to mimic it quite literally (to the
> point where I think I've said this before: if I wanted to code in C, I know
> where to find it).
It's precisely because I don't want to code in C either that the low-level API
of luaposix aspires to be as thin a wrapper for the C API as possible. It's
easier, faster and less error-prone to write the Luaish API on top of the thin
C wrappers in Lua than it is to write the fancy stuff in C.
Not only that, this leaves the door open to replace the C bindings with an FFI
binding that the Luaish layer can equally sit on top of and ultimately shipping
no C code at all in luaposix... as long as a dependency on LuaJIT and/or LuaFFI
is an acceptable compromise. When the low-level C code implements the user-
facing API, all of this is a lot more difficult.
Cheers,
--
Gary V. Vaughan (gary AT vaughan DOT pe)