You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucy.apache.org by Open Nota <op...@gmail.com> on 2014/02/22 16:12:09 UTC

[lucy-dev] Create bindings for a new language

Hello.

If one wants to develop lucy bindings for a new language, what should he
know and do? Can someone explain in general the process of creation of lucy
bindings, step by step? Should one make use of the clownfish (why?) or is
it sometimes desirable dispense with it? Is there a C library, that can be
linked against? Are there useful links and documentation? Anything you can
spare will be gratefully appreciated.

Re: [lucy-dev] Create bindings for a new language

Posted by Open Nota <op...@gmail.com>.
>And if you weren't aware, Philip Southam already started to work on Go
>bindings based on the Lucy C library:
>    https://github.com/philipsoutham/golucy

Wow. Somehow I wasn't aware of that. It will be better to continue work
from there, I think.


On Sun, Feb 23, 2014 at 7:02 PM, Nick Wellnhofer <we...@aevum.de>wrote:

> On Feb 23, 2014, at 05:16 , Open Nota <op...@gmail.com> wrote:
>
> > Thanks. That's why I'm asking - I've seen the docs state that the
> Clownfish
> > is good for dynamically typed languages. But I would want to write
> bindings
> > for the statically typed one - namely, Go. Is it worth the effort to mess
> > with the Clownfish backend and bindings for the statically typed
> language?
> > I certainly will ask more questions after I've acquainted myself with you
> > links.
>
> I think Clownfish should be useful for Go bindings, too. It doesn't make
> many assumptions about the host language and should work with any language
> that has some support for OOP and can interface with C code.
>
> Also, Clownfish isn't designed to be a turn-key solution. It mainly helps
> with the repetitive parts of writing language bindings. The rest has to be
> filled in by the implementor. If you want to write a new language backend,
> you could start with any code that can be generated from the Clownfish
> header files. It might also make sense to create bindings manually first
> and then work backwards to see where Clownfish can help to automate tasks.
>
> And if you weren't aware, Philip Southam already started to work on Go
> bindings based on the Lucy C library:
>
>     https://github.com/philipsoutham/golucy
>
> Nick
>
>

Re: [lucy-dev] Create bindings for a new language

Posted by Nick Wellnhofer <we...@aevum.de>.
On Feb 23, 2014, at 05:16 , Open Nota <op...@gmail.com> wrote:

> Thanks. That's why I'm asking - I've seen the docs state that the Clownfish
> is good for dynamically typed languages. But I would want to write bindings
> for the statically typed one - namely, Go. Is it worth the effort to mess
> with the Clownfish backend and bindings for the statically typed language?
> I certainly will ask more questions after I've acquainted myself with you
> links.

I think Clownfish should be useful for Go bindings, too. It doesn’t make many assumptions about the host language and should work with any language that has some support for OOP and can interface with C code.

Also, Clownfish isn’t designed to be a turn-key solution. It mainly helps with the repetitive parts of writing language bindings. The rest has to be filled in by the implementor. If you want to write a new language backend, you could start with any code that can be generated from the Clownfish header files. It might also make sense to create bindings manually first and then work backwards to see where Clownfish can help to automate tasks.

And if you weren’t aware, Philip Southam already started to work on Go bindings based on the Lucy C library:

    https://github.com/philipsoutham/golucy

Nick


Re: [lucy-dev] Create bindings for a new language

Posted by Open Nota <op...@gmail.com>.
Thanks. That's why I'm asking - I've seen the docs state that the Clownfish
is good for dynamically typed languages. But I would want to write bindings
for the statically typed one - namely, Go. Is it worth the effort to mess
with the Clownfish backend and bindings for the statically typed language?
I certainly will ask more questions after I've acquainted myself with you
links.


On Sun, Feb 23, 2014 at 2:48 AM, Nick Wellnhofer <we...@aevum.de>wrote:

> On Feb 22, 2014, at 16:12 , Open Nota <op...@gmail.com> wrote:
>
> > If one wants to develop lucy bindings for a new language, what should he
> > know and do? Can someone explain in general the process of creation of
> lucy
> > bindings, step by step? Should one make use of the clownfish (why?) or is
> > it sometimes desirable dispense with it? Is there a C library, that can
> be
> > linked against? Are there useful links and documentation? Anything you
> can
> > spare will be gratefully appreciated.
>
> If you want to write bindings for a dynamic programming language like
> Perl, Python, or Ruby, you're encouraged to build upon the Clownfish object
> system. It is designed to integrate very tightly with the host language and
> we expect the resulting bindings to be highly idiomatic and user-friendly.
> If you want to extend Clownfish, you'll also get lots of support from the
> Lucy community. For Python and Ruby, people have already started working on
> Clownfish support but we're still at an early stage.
>
> User documentation for Clownfish can be found here:
>
>
> https://git-wip-us.apache.org/repos/asf?p=lucy-clownfish.git;a=blob;f=runtime/perl/lib/Clownfish.pod
>
> To implement support for a language, you'll have to write a backend and
> bindings for the Clownfish compiler (CFC) and some glue code for the
> Clownfish runtime and the build system of the host language. The code for
> the Perl bindings should give you an idea what needs to be implemented:
>
> CFCPerl* files in compiler/src (CFC backend) to autogenerate the code for
> the bindings:
>
>
> https://git-wip-us.apache.org/repos/asf?p=lucy-clownfish.git;a=tree;f=compiler/src
>
> CFC Perl bindings:
>
>
> https://git-wip-us.apache.org/repos/asf?p=lucy-clownfish.git;a=tree;f=compiler/perl
>
> Perl code for Clownfish runtime (especially the code in the xs
> subdirectory):
>
>
> https://git-wip-us.apache.org/repos/asf?p=lucy-clownfish.git;a=tree;f=runtime/perl
>
> We also have an as-yet-unreleased C library which you can find in the 'c'
> directory of the Lucy Git repository. It depends on the Clownfish C library
> and tools.
>
> Feel free to ask more questions on this mailing list or on IRC (#lucy_dev
> on irc.freenode.net).
>
> Nick
>
>

Re: [lucy-dev] Create bindings for a new language

Posted by Nick Wellnhofer <we...@aevum.de>.
On Feb 22, 2014, at 16:12 , Open Nota <op...@gmail.com> wrote:

> If one wants to develop lucy bindings for a new language, what should he
> know and do? Can someone explain in general the process of creation of lucy
> bindings, step by step? Should one make use of the clownfish (why?) or is
> it sometimes desirable dispense with it? Is there a C library, that can be
> linked against? Are there useful links and documentation? Anything you can
> spare will be gratefully appreciated.

If you want to write bindings for a dynamic programming language like Perl, Python, or Ruby, you’re encouraged to build upon the Clownfish object system. It is designed to integrate very tightly with the host language and we expect the resulting bindings to be highly idiomatic and user-friendly. If you want to extend Clownfish, you’ll also get lots of support from the Lucy community. For Python and Ruby, people have already started working on Clownfish support but we're still at an early stage.

User documentation for Clownfish can be found here:

https://git-wip-us.apache.org/repos/asf?p=lucy-clownfish.git;a=blob;f=runtime/perl/lib/Clownfish.pod

To implement support for a language, you’ll have to write a backend and bindings for the Clownfish compiler (CFC) and some glue code for the Clownfish runtime and the build system of the host language. The code for the Perl bindings should give you an idea what needs to be implemented:

CFCPerl* files in compiler/src (CFC backend) to autogenerate the code for the bindings:

https://git-wip-us.apache.org/repos/asf?p=lucy-clownfish.git;a=tree;f=compiler/src

CFC Perl bindings:

https://git-wip-us.apache.org/repos/asf?p=lucy-clownfish.git;a=tree;f=compiler/perl

Perl code for Clownfish runtime (especially the code in the xs subdirectory):

https://git-wip-us.apache.org/repos/asf?p=lucy-clownfish.git;a=tree;f=runtime/perl

We also have an as-yet-unreleased C library which you can find in the ‘c’ directory of the Lucy Git repository. It depends on the Clownfish C library and tools.

Feel free to ask more questions on this mailing list or on IRC (#lucy_dev on irc.freenode.net).

Nick