lua-users home
lua-l archive

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


Dirk Laurie <dirk.laurie@gmail.com> writes:
> You'll get advice from people who like `swig` etc, but please do not
> take it.  Rather, consider the following opinion of David Heiko Kolf
> from another recent thread.

Or rather, consider taking it, but do not approach the subject blindly.

The problem with SWIG is mainly that it can generate bloated output --
but one of the _reasons_ it does so is that SWIG does lots and lots
and lots of the grot work for you.  I imagine the same applies to
other binding generators in varying degrees.

The basic point of the cited opinion seems reasonable to me:
A binding mechanically generated from some other language may not feel
very "luaish."

But there are other ways to address that issue than avoiding binding
generators.

For instance: use SWIG (or whatever) to generate an internal module,
and then add a thin Lua module on top of that that exports the desired
Lua-ish interface, calling into the internal module to do the real
work.  The user will see the "nice" module, and this sort of glue is
very easy to write in Lua.

-miles

-- 
A zen-buddhist walked into a pizza shop and
said, "Make me one with everything."