[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Literal mimicking of C APIs in Lua (split from Re: [ANN] luaposix 33.3.0 released)
- From: Dirk Laurie <dirk.laurie@...>
- Date: Sun, 1 Mar 2015 07:11:57 +0200
2015-03-01 6:16 GMT+02:00 Sean Conner <email@example.com>:
> 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).
> When I look over existing Lua modules like luasocket, luaposix, various
> other syslog implementations, I tend to see an almost slavish approach to
> mimicking the C API as closely as possible, instead of, for lack of a better
> term, Luaizing the API.
> The thing is---am I alone in doing this? Do I have a different way of
> handling C APIs in Lua? Is it more a matter of "following the C API as
> directly as possible because of existing documentation"? Or of "this is
> easier to do to get this out the door"? Or even "I didn't even think of
> doing that"?
I agree. You're probably right about documentation. But I think you
missed one possible reason why people do it: to make certain that
no feature is missing. Almost all C packages suffer from feature creep
on its inexorable progress into feature bloat.
My solution to this is to write a front-end to such packages, containing
simple interfaces only to those routines I actually use, providing only
those features I have actually needed.