develooper Front page | perl.perl6.language | Postings from April 2005

Inline code (was: Closure/block/sub multiplier)

Thread Previous | Thread Next
From:
Autrijus Tang
Date:
April 20, 2005 20:13
Subject:
Inline code (was: Closure/block/sub multiplier)
Message ID:
20050420213105.GA23617@aut.dyndns.org
On Wed, Apr 20, 2005 at 04:50:38PM -0400, Matt Creenan wrote:
> To expand on this...
> 
> How will you be able to access shared libraries with native code, such as  
> DLLs on windows?  Is there a way to do this proposed for Perl6 yet?  If  
> so, is it possible in PUGS?

It is possible in Pugs's Haskell backend by using the experimental,
unspecced (and will probably be changed) eval_haskell() primitive
to natively call Win32 DLLs.

Alternatively, you can write modules using the experimental,
unspecced (and will probably be changed) syntax:

    module SHA1-0.0.1;
    inline Haskell => '
    import qualified SHA1
    sha1 :: String -> String
    sha1 = SHA1.sha1
    ';

Inline::C support is also trivial, by translating the C signatures
into Haskell FFI calls, and adding them to Pugs.External.C.

In Pugs's IMC backend, I expect the same syntax to still hold; I have
started investigating interop with Parrot/Tcl, and it does seem
feasible.

Bringing the topic back to perl6-language, I'd like to inquire
how eval and inlining other languages works.  Here's some thoughts:

    eval('printf("Hello!")', :language<C>);
    eval(:C('printf("Hello!")'));

    inline C => '...';
    inline C => =<foo.c>;

If there is some consensus on this, I'd like to change Pugs's
existing `eval_perl5()` and `inline` syntax to agree with it.

Thanks,
/Autrijus/

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About