Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^6: v5, a reimplementation of P5 (was Re^5: A "Perl-7" that I could actually USE right now)

by BrowserUk (Patriarch)
on Jul 07, 2013 at 23:43 UTC ( [id://1043019]=note: print w/replies, xml ) Need Help??


in reply to Re^5: v5, a reimplementation of P5 (was Re^5: A "Perl-7" that I could actually USE right now)
in thread A "Perl-7" that I could actually USE right now

a worthwhile replacement for Perl 5.

I still don't get all this endeavour to re-write P5 in P6. P5 is perfectly embeddable.

Just embed perl5xx.dll/.so into the P6 compiler and provide:

  1. P6 built-in(s) to access p5 subroutines:

    Say something like:

    use P5 qw[ LWP::Simple ]; ... my $url :String = <...some P6 source>; my $content = p5call( "LWP::Simple::get( $url )" );
    ).
  2. P6 proxies for P5 objects:

    Say:

    use P5 qw[ DBI DBD::Pg ]; ... my $dbi = P5Object( "DBI->connect( $dataSource, $userName, $userAuth, +\%attrs" ); ); my $sth = $dbi->prepare( 'SOME SQL HERE' ); ...

Full compatibility at a stroke, and full P5 performance (within the p5 code), and a small hit through the thunking layer.

How hard could it be to write the thunking layer? (It's gotta be easier than recreating P5 + XS + everything else.)

I effectively do exactly this in my 15-line Perl5 REPL.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re^6: v5, a reimplementation of P5 (was Re^5: A "Perl-7" that I could actually USE right now)
  • Select or Download Code

Replies are listed 'Best First'.
Re^7: v5, a reimplementation of P5 (was Re^5: A "Perl-7" that I could actually USE right now)
by chromatic (Archbishop) on Jul 08, 2013 at 04:42 UTC
    How hard could it be to write the thunking layer?

    Keep in mind the current mindset is that everything has to be portable across all of the (hypothetical) backends that Rakudo (hypothetically) supports, so writing a thin embedding layer in C won't do. You have to write it in NQP and then hope that the backend allows you to invoke C functions in an efficient way. That's C for Parrot, JNI for the JVM, something like P/Invoke for the CLR, wishful thinking for v8, and magic unicorn fairy dust for MoarVM.

    It's gotta be easier than recreating P5 + XS + everything else.

    If P6 is optimized for -Ofun, then plumbing and maintenance and packaging and all of the other pieces of finish work that aren't glamorous must not be fun.

      lend me some of your dust ...

        Oh, I already wrote code to handle the sharing of entities between Parrot-hosted languages and Perl 5 (the hard part was walking between the two very different memory management strategies of garbage collection and reference counting). I'm sure that code's been lost to one of the annual purges, however. I have no desire to rewrite working code for the sake of P6's current implementation fad—but good luck doing that in a cross-platform way in NQP, or handling internal encoding and decoding in an efficient way, or dealing with system calls, or managing library paths, for example.

Re^7: v5, a reimplementation of P5 (was Re^5: A "Perl-7" that I could actually USE right now)
by raiph (Deacon) on Jul 10, 2013 at 22:59 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1043019]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2024-04-16 21:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found