[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Wishlists and Modules (was [ANN] libmc)
- From: Andre de Leiradella <aleirade@...>
- Date: Wed, 02 Sep 2009 19:06:09 -0300
I really miss the times when Lua was just an embeddable script language.
I could just compile all Lua libraries I wanted, make a host application
or change lua.c to open the additional libraries, link everything and be
Now I must leave with modules, dynamic link libraries, requires, paths,
packages, etc. Or I have to change the modules to compile as good
old-fashioned Lua libraries which is a great deal of work depending on
which ones I'm using. Or I have to write things from scratch instead of
reusing code from the community.
It's sad to see Lua move away from its niche. Or I'm completely missing
an obvious way to require modules that are compiled into the application
without hacks... In which case everyone is free to punch, ignore or
Date: Wed, 2 Sep 2009 10:22:32 +0200
From: steve donovan <email@example.com>
Subject: Wishlists and Modules (was [ANN] libmc)
To: Lua list <firstname.lastname@example.org>
Content-Type: text/plain; charset=ISO-8859-1
Anyway, remember - it *is* a wishlist. :-)
While we are exchanging wishlists, here's one of mine ;)
Although code may be free (in both senses of the English word) it can
still be expensive in terms of time needed to understand it. In an
ideal world there would be as little friction as possible in the
process, i.e. that when using a new module, the accidental complexity
should be as little as possible. (May well be essential complexity,
sometimes things _are_ rocket science.)
A The ideal module:
0 well named (using namespaces)
1 well focused
2 well contained
3 explicit dependencies
4 documented in some standard way
5 adequate test coverage
6 useful examples
A0 may seem obvious but namespaces are increasingly a must. CPAN is
looking after 16486 modules (!) and the only way that they can coexist
is by disciplined use of namespaces (e.g ). A project needs a cool
name, but a module needs a useful name.
A2 means that a module behaves itself and doesn't mess with the global
table, except to introduce its own table. A module can of course be
'injected' into the global table, but only on explicit request.
B And the ideal package manager:
1 handles dependencies
(must do this automatically, like LuaRocks )
2 integrated documentation
(must be available from a central index after installation, e.g
3 specifies external dependencies in a useful way
(in an ideal world, it use the native package manager to find these)
4 searchable for capabilities and module names
(e.g. that the module 'lfs' corresponds to the package
'LuaFileSystem' - new LR will do this)
5 flexible tag-based classification
(so we aren't tied to a inflexible fixed hierarchy, like the
Trove system )
It seems hard to do B2 without A4, without resorting to hacks &
heuristics (is there a README? is there an index.html, perhaps in an
'en' folder? ...) So naturally there have been Lua people interested
in the Perl POD format.
B4 & B5 are related; the idea is to get as much searchable metadata
into the system. And hierarchies can be constructed dynamically from
B3 is a tough one, which is hard enough to solve for one system (e.g.
Debian) let alone the whole universe of platforms, mostly without
standard library repositories.
This feels like a lot of work, which it is, but the idea is to
minimize the amount of work the producer of the module has to do.
Personally I think LuaRocks is getting there, especially with a nice
front-end; (the next version will be using a more 'normal' way to
manage modules) but delivering module documentation is not a major
concern and writing cross-platform rockspecs remains a bit of an art.
I've even toyed with the idea of writing a wizard for writing
Documentation remains a big weakness. Probably it's that
psychological illusion that code is self-evident, because one's head
is full of the 'meta-implementation', all that stuff and cogitation
needed to write a program, and which evaporates quickly and leaves us
saying WTF? when reading our own code in six months.
Date: Wed, 2 Sep 2009 04:30:05 -0500 (CDT)
From: yxtor <email@example.com>
Subject: Re: Lua/SWIG: output parameters of custom types as
Content-Type: text/plain; charset=us-ascii
Hello. I am a new user here at Nabble.
I wonder if anybody has an answer to Sebs question? Its really hard finding
Sebastian Wolff wrote:
Dear Lua community,
I hope someone already encountered the following problem and may assist
finding a solution.
I have an own object class type MyClass and want to wrap a C++ library
using SWIG 1.3.39 to be used by Lua. Using this library I often have to
wrap methods of the form
void foo1(const MyClass & a, MyClass & b)
void foo2(const MyClass & a, MyClass & b)
void foo2b(const int &a, int &b)
b += a;
'foo1' simply returns 'b' reading 'a'. foo2 and foo2b modify 'b' using
'a'. Therefore, in Lua I want to call them by
b = foo1(a)
b = foo2(a,c)
b = foo2b(a,c)
To let SWIG know about the parameter types one has to specify which is
INPUT, OUTPUT or both:
void foo1(const MyClass & INPUT, MyClass & OUPUT);
void foo2(const MyClass & INPUT, MyClass & INOUT);
void foo2b(const int & INPUT, int & INOUT);
For 'foo2b' this is working fine. Somehow it does not work for 'foo1'
and 'foo2'. In the latter, all parameters are considered being input
Any ideas what went wrong?
View this message in context:
Sent from the Lua list mailing list archive at Nabble.com.
End of Lua Digest, Vol 170, Issue 3