The facts that (a) it's not in the Perl 6 ecosystem, (b) it's not version 1.0 yet, (c) I haven't even added support for lists yet (need to talk to nine) and (d) I stated that it wasn't ready, should make it pretty clear that this isn't a finished product, I'm sorry if I gave that impression.

Also, if you read the full posting I'm fully intending to create a Slang::Scheme::Guile that will actually embed the language inside Perl 6 to the point of being able to write:

use Slang::Scheme::Guile; guile-sub add( $x, $y ) { + $x $y }

Passing in variables marshalled in from another language is trivial, and clearly documented as scm_call_*, with list creation clearly documented as scm_list_*. There is an entire section devoted to a tutorial on how to create your own custom procedures and even entire object types that you can invoke from within Scheme. In fact, with a little bit of work it might be possible to let the Slang user create their own classes and export them as Scheme objects.

In fact, the time I'm taking to write this response is longer than it would take to create a sample Scheme function written in C, creating the Perl callback would take a little longer. I don't have the documentation to hand as I'm outside my development VM here, but a sample C function that exposes a color attribute from Lilypond (one of the programs that hosts a Guile interpreter) to Scheme is roughly 10 lines of code, including marshalling the 24-bit alpha mask from Lilypond's internal format to Scheme.

Also, please remember that Guile Scheme is designed to be an embedded language. Look at the Wikipedia page to see how many applications, including GNU Make, are using it as an embedded language. This is one of the reasons I chose this Scheme implementation to embed, rather than say, SIOD or some other library.

Lastly, if you'll read the Guile Scheme documentation, you'll see two whole sections devoted to letting Guile Scheme access the host application, including a lengthy tutorial on creating custom Guile Scheme types customized for your application.

If you think it's easier to (1) write a new Scheme on top of MoarVM, (2) modify the Perl 6 runtime to allow a whole new language in parallel with the existing Perl 6 binary, (3) write a new ICE-9 function library on top of your new Scheme implementation in order to call back to Perl, (4) not go completely mad writing call-with-current-continuation to unwind a stack from Scheme to Perl 6 across two interpreter threads, and (5) do this all in the time it'll take me to add an ICE-9-Perl6 function library, you're more than welcome to take on the challenge, and I doff my hat to you.


In reply to Re^4: Introducing Scheme In Perl 6 by DrForr
in thread Introducing Scheme In Perl 6 by DrForr

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.