[Xapian-discuss] PHP bindings
olly at survex.com
Mon Oct 2 13:53:03 BST 2006
On Mon, Oct 02, 2006 at 01:22:37PM +0100, James Aylett wrote:
> On Mon, Oct 02, 2006 at 12:32:12PM +0100, Olly Betts wrote:
> > So if you use the Xapian bindings under PHP4 (not PHP5!), do you think
> > the pain of updating your code is worth the gain from the more OO-like
> > API? If there was a simple script which did most of the work of
> > updating your scripts, would that change your opinion?
> If it's a significant pain, it would be possible to write a pure-PHP4
> wrapper for the flat function names that mapped to the OO style,
> wouldn't it? Programmatically from xapian.i, in fact...
Many things are possible - the PHP5 wrappers I've got SWIG to generate
could probably be adapted. Or SWIG could be modified to generate both
the flat and object C++ wrapper code for PHP4 (which I suspect would be
less work). Or we could just provide two different PHP4 bindings, but
that's increased packaging effort.
But PHP4's object model is lacking some rather fundamental features
(e.g. static methods and private methods) so if you want to write OO
PHP, then PHP5 is a far better choice. So I'm not convinced the effort
required to implement any of the above approaches is worthwhile,
particularly as the current PHP4 support is completely usable.
Also, PHP5 seems to be significantly better than PHP4 in a number of
ways, and my impression is that PHP5 adoption has reached critical mass.
I think PHP4's days are numbered at this point.
So I'm unlikely to work on this myself. If someone else is interested
I'm happy to incorporate the results, assuming it's done in a sane way.
More information about the Xapian-discuss