lua-users home
lua-l archive

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

Has anybody written a srfi-4-like (
library for lua?

Some more context:

I have already embedded lua in one C++ project and the results were stellar.
After trying out guile, chicken, mzscheme, gambit-c, tcl, python and ruby,
it was refreshing to find a language that doesn't suck _and_ is easy to embed.
PiL2 is such a joy to read, full of great ideas on language design, in some
ways it reminds me the scsh manual.

I am now trying to use the lua repl as the glue between various
numeric / geometric libraries.   While writing bindings, I came to
realize that it would be great if there was a semi-standard way to
manipulate homogeneous vectors from lua.  Such a library should
be accessible from both lua and C and would simplify the writing
of glue code.

Possible solutions I've already thought of:

1) Avoid homogeneous vectors, just convert before and after the C function
to lua tables.  This method works, but is not optimal when you're
writing a binding
for BLAS/LAPACK and you have *huge* vectors.

2) Writing such a srfi-4 like library is easy, just go ahead and write
it.  In that case,
it would be nice to avoid duplication.  I am thinking of starting such
a project, should
not take much time to wrap the 10 datatypes from srfi-4 and provide both C & lua
apis.  Would anybody be interested in such code?

3)  A library like that already exists / there is a better way.  In
that case, can
you share some pointers / ideas ?