AFAIK there's no XS with perl 6, so just *how* does one extend perl6 ?

The highest level sugar of all for extending P6 with code from other langs starts with a use some::module:from<otherlang> statement. For example that's how you call Java code.

I mean, if I find a really cool C library whose functionality I want to wrap, precisely how do I go about doing that ?

In an ideal world you'd use the above sugar. In the real world things aren't quite that simple (a long discussion about this today on #perl6).

Fortunately there's a really nice lower level interface called NativeCall (codename Zavolaj) so you use that instead.

Is the procedure well laid out in the perl 6 documentation ?

Imo the formal doc is weak. I recommend interested parties first focus on this Advent Calendar post from a couple years ago.

NB Right now you need to use Rakudo/Parrot to use NativeCall. (The final fixes for it on Rakudo/JVM are expected this month. My guess is that it'll be another few months before Rakudo/MoarVM catches up.)

Also note that some of the doc is ahead of implementation, some of it behind.

Is it a big learning curve ?

For a 60 second intro, see this short example.

I particularly like the way NativeCall supports use of P6's is repr trait to overlay P6 objects and C structs. This combines high performance (the same memory is used by both langs for fast and memory efficient execution) with coding convenience -- you just write ordinary object oriented Perl 6 code to read/write from/to a C Struct!


»ö« . o O ( "the celebrity tell-all of the Perl-6 cult?" )


In reply to Re^2: Concurrency in Perl 6 by raiph
in thread Concurrency in Perl 6 by raiph

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.