lucy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Logan Bell <>
Subject [lucy-dev] Shuffling Lucy Binding Code
Date Wed, 11 Jan 2012 16:56:53 GMT

As of recently I've been porting some of the Lucy binding code
(trunk/perl/xs/XSBind.c) for Perl over to the Ruby tree. This work is
associated with LUCY-207. One of things I've been discussing on IRC
with Marvin is how XSBind.c is referenced by eval Perl strings below
the __BINDING__ token in pm files within
trunk/perl/lib/Lucy/Object/*.pm. During the build process these code
blocks are evaled by, and creates the necessary Perl to C
binding. This pattern is acceptable strictly for a Perl environment,
but is difficult to model in other dynamic languages. One of the ideas
we've been discussing is moving the binding code away from beneath the
__BINDING__ block and into individual Perl modules within

The benefit to doing this code shuffling is the following:

1. Creates a more cross language friendly environment. For example, if
someone were to study the Perl directory structure with the goal of
creating Python bindings, they could more easily follow the directory
structures and create the necessary Python to C binding files.
However, this is not the case with the BINDING code in place.

2. Removes some of the hacks that were created to make __BINDING__
work. I believe there were a few hacks put in place to make the code
chunks be POD friendly.

An example of how this might work would be the following:

1. Move the code chunk from __BINDING__
trunk/perl/lib/Lucy/Object/ to

    package Lucy::Build::Binding::Object;

    sub bind_all {
        my ( $class ) = @_;

    sub bind_charbuf {
        my $xs_code = "...";
            parcel       => "Lucy",
            class_name   => "Lucy::Object::CharBuf",
            xs_code      => $xs_code,

2. Updated to call the individual Modules in
buldlib/Lucy/Build/Binding/*.pm build_all function, and remove the
evaling of __BINDING__ chunks.

I would like to propose this change set to the dev list and welcome
any + or -'s to such a change.


View raw message