lua-users home
lua-l archive

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

On Wed, Jun 18, 2014 at 7:33 PM, Philipp Janda <> wrote:
> I consider a C binding to be low-level if there is a one-to-one
> function/type mapping between the Lua API and the C API. I usually adapt the
> following:
> ....

These are excellent points; the idea is to exploit the expressiveness
and flexibility of Lua.

C is not a very expressive language (and I speak here as a fan) and
many of its idioms are work-arounds, e.g. returning errors by setting
a 'global' errno and so forth - because of a lack of easy multiple
return, or lack of exception handling, depending on which team you
support.  Or the sad fact (as Stroustrup says) that C arrays don't
even know how big they are. C's expressive weaknesses are legion.

To stick to the original API is missing an opportunity to make that
API better and more accessible to others. It's a common strategy to do
a minimal binding (or use FFI) and then build something more elegant
on top of that.