lua-users home
lua-l archive

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


2011/8/18 Patrick Mc(avery <patrick@spellingbeewinnars.org>:
> Luiz's point was so obvious and of course I needed someone to point it out
> to me, just write a Lua API over a C API. Sean's example is very straight
> forward and I could see this as easy enough to maintain but does anyone have
> feedback on maintainability with these two techniques? If I write a Lua API
> for a C API and the C API breaks so does the Lua one and of course they both
> break if the C core breaks. If the the C API breaks but not the C core the
> Lua API would not break. Does one strategy have more merit over the other,
> is there a third option?

If your Lua API is a wrapper for the C API, there is no difference
between the C API and the C core, since the former is the only way to
use the latter. So the case "C API breaks, C core works" just cannot
happen.

The only real benefit I see in splitting the C core and the C API, is
if you want to use some parts of the core in the Lua wrapper, but
don't want to expose it through the C API. For example you could force
the C API users to go through a reference counting scheme, while
having the Lua API be based on the garbage collector. In that case the
two APIs would use slightly differents (but mostly overlapping) parts
of the core.