[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: XML Support for Penlight?
- From: Alex Bradbury <asb@...>
- Date: Mon, 28 Mar 2011 14:53:24 +0100
On 28 March 2011 13:59, steve donovan <steve.j.donovan@gmail.com> wrote:
> Now the question is this: I've received a few feature requests for XML
> support in Penlight, and I'm wondering what collective wisdom feels
> about basic pure Lua XML read/write support being included. Generally
> I've felt that this is the job of LuaExpat and friends, but this does
> seem to be a core need these days. (There is already support for
> common config file formats like INI etc.)
I think the key is to be clear about what you're providing, which is
almost definitely going to be XML subset support (XML parsers are
hard). See what Glib offers for instance:
http://library.gnome.org/devel/glib/2.28/glib-Simple-XML-Subset-Parser.html.
I would strongly encourage you to adopt such an approach - in that bug
reports stating "this nasty XML from my real-world app won't parse"
are met with a suggestion to use a proper XML parser. This also means
the Penlight XML implementation can be relatively lightweight, easy to
read and maintain.
I mostly support the inclusion of such an XML subset due to the
use-case for parsing and writing config-files etc. It's difficult to
decide in general where the boundary should lie. I definitely agree
networking and databases etc belong in separate projects. I could
imagine LTN12 fitting in well to Penlight, or I guess the
try/protect/newtry system from Luasocket too.
I'm a little unsure about your recent attempts to cut-down on
inter-module dependencies (though admit I haven't had a look at the
changes you've actually made recently). It makes sense that you
shouldn't need some future Penlight XML module to use other
functionality, but it seems that if the purpose of Penlight is to
provide commonly useful and well-tested functionality on which to
build larger bodies of Lua code isn't it only logical that the more
complex parts of Penlight will have dependencies on other Penlight
modules?
To throw another possible Penlight addition into the ring - what would
you think about offering something like ilua (as a library) in
Penlight? This could allow you to drop to a REPL at a certain point in
your code to help debug, or make it easier to add REPLs to simple GUIs
which embed Lua. Just a thought. Plus presumably it can re-use all the
Penlight pretty-printing stuff which is most of the work.
Alex