I'm cc:-ing my reply to xapian-devel, since others may have an opinion.
In particular, James has probably done most work on the python bindings.
On Fri, Jan 27, 2006 at 03:56:23PM -0800, Jason Toffaletti
wrote:> I'm curious if boost::python has been considered for creating more
> pythonic bindings to Xapian. I've used it to wrap several C++ libraries
> and found the resulting python bindings to be much nicer than SWIG.
First off, I'm a relative novice at python, so you'll need to explain
what you mean by "more pythonic" if you want me to understand why
boost::python might be better. Note that the SVN sources have a
number of improvements for python (and other languages) over 0.9.2 -
snapshots available here if you want to take a look:
http://www.oligarchy.co.uk/xapian/trunk/
I'd not heard of boost::python before. The disadvantages compared to
SWIG would appear to be:
* We already have working SWIG bindings for python.
* James and I have a reasonable understanding of how to wrap stuff
using SWIG.
* boost::python would require its own interface description, which is
yet another place to need to add a new method. We already need to add
it to xapian.i for SWIG, to the Java JNI bindings in several places,
and to the appropriate .xs file for Perl, in addition to changing
the C++ code and headers. SWIG's xapian.i is trivial to update in
many cases - just copying the method prototype over generally works.
At a cursory glance, I can believe that boost::python has a cleaner
design than SWIG and is probably easier to use, but then it only
addresses one language. I found some work has been done towards
generalising it as boost::langbinding, but that seems to have largely
stalled. There's also a related project for TCL:
http://cpptcl.sourceforge.net/
"It was inspired by the Boost.Python library and was deliberately
designed to provide a similar interface, taking into account the
limitations of Tcl."
I couldn't find anything which says how similar - if we could use the
same file like we can for SWIG, that's great, but having to maintain
two very similar files would be annoying.
If you're offering to write and maintain python bindings for Xapian using
boost::python, we could well be interested. The main issues would seem
to be how to have an upgrade path from the SWIG python bindings, and
what we'd do if you are unable to continue to maintain them.
Otherwise, I can't help wondering if it wouldn't be easier to improve
the existing SWIG bindings to be "more pythonic".
Cheers,
Olly