lua-users home
lua-l archive

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


On Fri, Sep 28, 2012 at 1:28 PM, Tom <tmbdev@gmail.com> wrote:
>> note that even in C it's a very rare coincidence when unrelated
>> libraries are so interoperable
>
>
> What I showed in the Lua example was returning one typed array from one
> library and passing it to another library.  In C, the "typed array" is a
> pointer, and it actually is the primary means of exchanging large amounts of
> data between libraries.

that only works for byte blobs.  doing that with LuaJIT's FFI is
trivial, no more than five lines or so if you want to hide the sharp
corners to Lua scripts.

anything further has to have some semantic agreements to work.   in
your PIL example there's at least the "8 bits per sample, RGB pixels,
left to right, top to bottom" protocol, which is not a language
feature, but a consequence of the problem domain.  Again, writing
exactly that in FFI is trivial.

in short, I don't think there's a small set of (missing) language
features that would significantly increase interoperability.  the
primitive building blocks are there, and for specific domains the best
is to create them as needed.

-- 
Javier