You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucy.apache.org by Nick Wellnhofer <we...@aevum.de> on 2014/07/07 01:13:00 UTC

[lucy-dev] Streamlining the parcel bootstrapping process

Lucifers,

there are two things I’d like to change about the Clownfish bootstrapping process.

1. Clownfish projects currently have to provide a bit of XS boilerplate to call the generated bootstrap function. For example, have a look at my example C extension:

https://github.com/nwellnhof/LucyX-Analysis-WhitespaceTokenizer/blob/master/perl/buildlib/Binding.pm

I’d like to generate that automatically.

2. A second initialization function called _init_autobindings() has to be called manually from Perl:

https://github.com/nwellnhof/LucyX-Analysis-WhitespaceTokenizer/blob/master/perl/lib/LucyX/Analysis/WhitespaceTokenizer.pm

Is there any reason for a separate function? Couldn’t it be rolled into the bootstrap code directly?

Nick


Re: [lucy-dev] Streamlining the parcel bootstrapping process

Posted by Nick Wellnhofer <we...@aevum.de>.
On Jul 9, 2014, at 05:35 , Logan Bell <lo...@gmail.com> wrote:

> On Tue, Jul 8, 2014 at 8:02 AM, Nick Wellnhofer <we...@aevum.de> wrote:
> 
>> On 08/07/2014 03:49, Marvin Humphrey wrote:
>> 
>>> Clownfish needs a "clownfish-starter" script which generates a boilerplate
>>> project layout.  (Unix-only would be fine, probably Perl or sh.)
>>> Convention
>>> over configuration and all that.
>>> 
>> 
>> +1
> 
> 
> Sounds good to me, +1. This sounds very Perl specific, ie it's generating
> XS glue. Is this sort of boilerplate needed for future languages?

It’s not about generating XS glue. That’s handled by CFC. It’s about creating an initial project directory with a couple of files like

* perl/Build.PL
* perl/lib/My/Module.pm
* core/My/Module.cfp
* core/My/Module.cfh
* core/My/Module.c

This would be useful for other host languages, too.

Nick


Re: [lucy-dev] Streamlining the parcel bootstrapping process

Posted by Logan Bell <lo...@gmail.com>.
On Tue, Jul 8, 2014 at 8:02 AM, Nick Wellnhofer <we...@aevum.de> wrote:

> On 08/07/2014 03:49, Marvin Humphrey wrote:
>
>> Clownfish needs a "clownfish-starter" script which generates a boilerplate
>> project layout.  (Unix-only would be fine, probably Perl or sh.)
>>  Convention
>> over configuration and all that.
>>
>
> +1


Sounds good to me, +1. This sounds very Perl specific, ie it's generating
XS glue. Is this sort of boilerplate needed for future languages?


>
>
>  Presumably running `clownfish-starter --perl` would generate that XS
>> boilerplate.
>>
>
> What I meant was to let CFC autogenerate the XS boot section. This is now
> implemented:
>
> https://git-wip-us.apache.org/repos/asf?p=lucy-clownfish.
> git;a=commitdiff;h=7f78db45f5deaec077add980603b40331de0a127
>
> Now you can write a simple Clownfish project without a single line of XS
> code.
>
>
>  Yes, _init_autobindings can be rolled into the bootstrapping.
>>
>
> Also implemented:
>
> https://git-wip-us.apache.org/repos/asf?p=lucy-clownfish.
> git;a=commitdiff;h=f4e7f6c098321d0574e46d4f2be07f01d8012d44
>
> Another thing I'd like to change is the way the code in the Binding.pm
> modules is called. For simple projects it should be enough to define a
> subroutine in Build.PL and pass it to Clownfish::CFC::Perl::Build.
>
> Nick
>
>

Re: [lucy-dev] Streamlining the parcel bootstrapping process

Posted by Nick Wellnhofer <we...@aevum.de>.
On 08/07/2014 03:49, Marvin Humphrey wrote:
> Clownfish needs a "clownfish-starter" script which generates a boilerplate
> project layout.  (Unix-only would be fine, probably Perl or sh.)  Convention
> over configuration and all that.

+1

> Presumably running `clownfish-starter --perl` would generate that XS
> boilerplate.

What I meant was to let CFC autogenerate the XS boot section. This is now 
implemented:

https://git-wip-us.apache.org/repos/asf?p=lucy-clownfish.git;a=commitdiff;h=7f78db45f5deaec077add980603b40331de0a127

Now you can write a simple Clownfish project without a single line of XS code.

> Yes, _init_autobindings can be rolled into the bootstrapping.

Also implemented:

https://git-wip-us.apache.org/repos/asf?p=lucy-clownfish.git;a=commitdiff;h=f4e7f6c098321d0574e46d4f2be07f01d8012d44

Another thing I'd like to change is the way the code in the Binding.pm modules 
is called. For simple projects it should be enough to define a subroutine in 
Build.PL and pass it to Clownfish::CFC::Perl::Build.

Nick


Re: [lucy-dev] Streamlining the parcel bootstrapping process

Posted by Marvin Humphrey <ma...@rectangular.com>.
On Sun, Jul 6, 2014 at 4:13 PM, Nick Wellnhofer <we...@aevum.de> wrote:
> there are two things I’d like to change about the Clownfish bootstrapping process.
>
> 1. Clownfish projects currently have to provide a bit of XS boilerplate to
>    call the generated bootstrap function. For example, have a look at my
>    example C extension:
>
>    https://github.com/nwellnhof/LucyX-Analysis-WhitespaceTokenizer/blob/master/perl/buildlib/Binding.pm
>
> I’d like to generate that automatically.

+1

Clownfish needs a "clownfish-starter" script which generates a boilerplate
project layout.  (Unix-only would be fine, probably Perl or sh.)  Convention
over configuration and all that.

Presumably running `clownfish-starter --perl` would generate that XS
boilerplate.

A Clownfish tutorial would involve running this script as a first step.

> 2. A second initialization function called _init_autobindings() has to be called manually from Perl:
>
> https://github.com/nwellnhof/LucyX-Analysis-WhitespaceTokenizer/blob/master/perl/lib/LucyX/Analysis/WhitespaceTokenizer.pm
>
> Is there any reason for a separate function? Couldn’t it be rolled into the
> bootstrap code directly?

Yes, _init_autobindings can be rolled into the bootstrapping.  The historical
reason for that function was to load an autogenerated .pm file containing Perl
hashes which were used for param checking.  Nowadays param checking is built
into the generated XS.

Marvin Humphrey