[FoRK] XML API examples

Luis Villa luis.villa at gmail.com
Wed Jun 23 22:27:51 PDT 2004


On Wed, 23 Jun 2004 23:09:08 -0500, Adam L Beberg <beberg at mithral.com> wrote:
> 
> On Jun 23, 2004, at 9:53 PM, Luis Villa wrote:
> 
> >>> Right now my reason for using C is very specific -- avoiding a
> >>> rewrite of
> >>> the package for every high level language.
> >>
> >> One reason why I exported a TCP socket with an extremely simple
> >> HTTP-based
> >> protocol, as the API to SpamAssassin.  they can write extremely simple
> >> client libs in each high-level language.  but that only helps if you
> >> have a simple API...
> >
> > Yeah. If you have a complex API, and you want to wrap it in other
> > languages, your hands are pretty badly tied :/
> 
> Hardly. As long as the API is designed with "wrapping" in mind from the
> start, you can get as complex as you want to get. If you shove
> everything into a nice struct, so that the external API can just have
> simple data types as parameters, and let the C do the work, you'll be
> fine. You only get in trouble when you go exposing the gooey center to
> the high level language.
> 
> It's _all_ C underneath.

Given that C sucks, saying 'your hands aren't tied- do whatever you
want, as long as C is underneath' still sounds a lot like your hands
are tied. It's 'you can get a Ford in any color you want, as long as
it is black' all over again.

I did see an interesting spin on this today, though:
http://pylucene.osafoundation.org/

basically, they're using gcj to take the core library (lucene, written
in java instead of C) and create something that python can treat as C
for the purposes of linking and wrapping. Neat hack.

Luis


More information about the FoRK mailing list