[Xapian-devel] GSoC 2011 - Improve Existing Bindings

Olly Betts olly at survex.com
Tue Mar 22 00:29:24 GMT 2011


On Mon, Mar 21, 2011 at 05:28:44PM +0000, Abdul Rauf wrote:
> James mentioned "SWIG C# supports directors, meaning that user code written
> in C# can be passed as callbacks to some parts of Xapian, so it would good
> to provide some examples of this". With this, I understand that you need
> examples of c# code passing as callbacks to Xapian. Is it right?

Yes - for example, see the "simplematchdecider" example in Python.

> Could you please specify what do you mean by "idioms" as this is a new term
> for me. What I understand that it means close to the target language like
> e.g., if there is a wrapper for c#, the wrapper should make the user feel as
> writing in c#?

Yes.

In language an idiom is a figure of speech - so in English, you might
say you're "getting your feet wet with Xapian", meaning you're starting
to work with it in simple ways.  But in another language, you probably
wouldn't say that literally translated.

And it's kind of similar in code - there are ways to write something on
one language which don't seem natural when literally translated to
another (and SWIG's automatic translation is mostly a literal one):

http://en.wikipedia.org/wiki/Programming_idiom

> Olly mentioned "One obvious think to look for: anything that gets
> wrapped as something involving SWIGTYPE really needs addressing". It
> means that this is the first task to start with.

Perhaps a more gentle start would be to add some more test cases (with a
focus on where the current wrappers do a good job).  That would (a)
ensure that the current wrappers actually work as intended, (b) help to
ensure that these continue to work as you change things, and (c) get you
used to the API.

You can look for test ideas at the smoketest.* scripts in languages like
Python, Ruby, and PHP, which have better test coverage.

The SWIGTYPE stuff is a good place to start actually working on the API
though.

> Also, I did agree with Olly that Java bindings could be improved too as C#
> and Java are quite similar. I have more than 1 year of JAVA experience.

Cool.

Cheers,
    Olly



More information about the Xapian-devel mailing list