"vadim" <[EMAIL PROTECTED]> wrote:
On behalf of the Pugs team, I am elated to announce the release of
Pugs 6.2.5, with much more comprehensive OO support, hyper and reduction
metaoperators on user-defined operators, as well as experimental
coroutine support.
Could you please advice, how is it possible to use external library, or
better just C code?
Perl6 <-> C binding.
Should I use Haskell for this? Should I use parrot?
To be more concrete, I want to start using Tcl/Tk from within perl6
(like currently Tcl::Tk CPAN module does this)
At first I tried TclHaskell, which currently is out of date, and it took
considerable efforts for me, unknowledgable in Haskell, to make it
compile, but even after that is is non-trivial to move on, however seems
doable.
Which approach will you advice?
If I were doing this then I'd take my C library and write some kind of
wrapper for it using Parrot. Parrot's NCI (Native Call Interface) lets you
load a dynamically linked library/shared object and call functions in it (I
once wrote a script that auto-gen'd Parrot calls for the entire Win32 API).
Then you can write a Perl6 module that inlines PIR (Parrot code) that loads
your Parrot code wrapping the C library and calls the functions you want,
and wrap all of this again in some nice Perl 6 module/class.
I believe that the plan is that Pugs will be re-written from Haskell into
Perl 6, so writing your binding to the C library with Haskell's support for
doing so probably won't be a long-term solution to your needs.
Hope this helps, and corrections welcome (all(qw/beer wine baileys/) ==
none(@good_idea) ;-)).
Jonathan