[Xapian-discuss] Another PHP 5 wrapper...

Olly Betts olly at survex.com
Fri Apr 14 04:11:46 BST 2006


On Thu, Apr 06, 2006 at 05:00:52PM +0200, Daniel M?nard wrote:
> Paul, this is another brilliant idea, but if swig is able in a near 
> future to generate the php wrapper directly, I'm not sure it's worth 
> spending time on improving the wrapper.
> I also guess that it will be hard to include phpdoc in the generated 
> wrapper, so my point about having documentation goes away, no ?

Not necessarily - SWIG's Python backend allows you to generate pydoc
strings (either automatically, or specified explicitly, or a mix of
the two).  There's no good reason why the PHP backend couldn't too.

> Olly Betts wrote:
> >(...)I'd favour getting SWIG to generate the
> >wrapper code rather than trying to maintain it by hand.  Kevin Ruland
> >(the current SWIG PHP maintainer) is looking to move SWIG's PHP support
> >in this direction anyway.
> 
> I totally agree with the "easy maintenance" argument : if SWIG is able,
> in a near future, either to generate native OO extension for PHP, or to
> generate a PHP wrapper around flat bindings, this is a far better approch.
> 
> Do you know if/when adding this feature to SWIG is planned ?
    
I've been having a hack this evening, and now have a version of SWIG
which can generate PHP wrapper classes around the flat bindings which
are something close to what we want (using some of Paul's tricks for
coercing arguments, etc).

It needs some cleaning up (in particular, I think I've finally worked
out where I should have hooked in the new code and it's not where I
actually put it!) But it's well past time I went to bed, so that'll have
to wait.

But it already works well enough to run a "objectified" version of
smoketest.php.

> Paul Dixon wrote:
> >Daniel can answer that, I don't *think* I used anything 5.1 specific.
> >v5.1 did include a lot of bug fixes and some enhancements to the
> >Standard PHP Library (SPL) which Daniel might have used?
>
> Only because I used the Countable interface, which is not very important.

Is there a way we can write code which uses Countable for PHP 5.1 and
later but not on 5.0?

Cheers,
    Olly



More information about the Xapian-discuss mailing list