lucy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marvin Humphrey <>
Subject [lucy-dev] Clownfish::CFC::Binding::* implementation language
Date Sat, 14 Jan 2012 04:07:38 GMT

While working on LUCY-142 (Port Clownfish compiler to C), I went a fair
distance towards porting the code under Clownfish::CFC::Binding::Perl* to C.
But then during December, I reverted those modules to their pure Perl
implementations under the rationale that it was never going to be important to
generate Perl bindings from Ruby, Ruby bindings from Python, etc.

Logan and I have come up with a new reason why Clownfish::CFC::Binding::*
should be implemented in C after all, rather than in the target host language.
If we write Clownfish::CFC::Binding::Ruby in Ruby, then we need to create Ruby
bindings for the bulk of CFC -- basically, we'd need to port
clownfish/perl/lib/Clownfish/CFC.xs, which is a couple thousand lines of XS
code (plus some support code in  SWIG is an option because it's OK if
the bindings for CFC present a lousy interface, but SWIG brings its own
inconveniences and would still require a certain amount of customization.
This would have to be repeated for each target host language -- overall, a
significant chunk of code and effort.

The other possibility is to implement Clownfish::CFC::Binding::Ruby in C,
allowing that code to interface with the rest of CFC's C implementation
directly and removing the need for an elaborate translation layer.  Then we
only need to write enough glue code to make it possible to specify bindings
from Ruby.

Additionally, if we go that route it will be easier to take an existing CFC
host language binding implementation and adapt it for a new host language.  We
can start off by finishing the porting of Clownfish::CFC::Binding::Perl* and
then using the resulting C source files as a basis for

Later, once we port CFC's tests to C, most of the code in CFC.xs will become
obsolete, allowing us to chop it down to a couple hundred lines.

If there are no objections, this is how Logan and I presently plan to proceed.

Marvin Humphrey

View raw message