[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Automatic bind generator
- From: Tangent 128 <tangent128@...>
- Date: Tue, 12 Mar 2013 01:50:27 -0400
On 03/11/2013 02:09 AM, William Ahern wrote:
> <snip>
> I've taken to installing C bindings as module _foo.so. The Lua module,
> foo.lua, then implements iterator interfaces, I/O polling, etc. I allow the
> Lua code to insert or interpose class methods like
>
> local foo; foo = class.interpose("foo", function (self, ...))
> return foo(self, ...)
> end)
>
> How do other people handle this? Just do it all using the Lua C API?
>
>
I've seen that in your cqueues code (very nice socket/signal library for
5.2, I might add), and I admit it seemed a bit overcomplicated to me; my
preference is to just give an "ugly" name to the C functions needing a
Lua wrapper, and let the wrapper take the cleaner name. For instance,
cGrabClientSocket and cUnlink.
By my logic, if you are building a sandbox, then you'll be taking
specific whitelisted functions from the module anyways; if you don't
need a sandbox, then you can hopefully trust other code to not call
non-public-API functions. (Though I admit horror scenarios are easy
enough to envision.)
-Joseph Wallace