Reading through the Parrot Answers page, I came across this intriguing question:

12) p52p6 by rafael

Have you an idea about the implementation of the "official" p52p6 translator ? OK, that's not really Parrot-related. Just to know how you feel about this.

Yep, I've thought about it. There are three ways to go about it, and we're likely to use all three.

  1. A B::Parrot module that turns a perl 5 optree to Parrot bytecode
  2. The Perl 5 parser/lexer/tokenizer code on a Parrot back end
  3. A native perl 5 parser module for Parrot.


That's likely the order we'll take them in, too.



Also, looking at the perl6-update file, I find piont 5 that is related to this question:
5) Clean up the language
  . . .
  - Perl5 to Perl6 compiler?
    - Automatic translation
    - 100% translation for 80% of Perl programs
    - 95% translation for 95% of Perl programs
So, from what I've seen so far (and quite understandable) I can't expect to be able to seamlessly translate all of my Perl5 scripts over to Perl6 code? On average, there should still remain 15%-20% of legacy code that I'll have to worry about on an individual basis and invest extra time to manually upgrade this code to Perl6.


Since work on the Parrot and, consequently, Perl6 is well underway, I think it is time for me to start asking these questions. Should I write my code such that it could be easily translated to Perl6 requiring only minimal 'manual labor' (getting inside the code and changing things on my own :)? In which case, how do I know the part of Perl5 that couldn't not be properly translated into Perl6? I realize that there's a lot of places where one could read more on the specifics of the new Perl language. The first thing that springs to my mind are the Apocalypse series by St. Larry Wall. There, I learn, for example, that the first thing to be dropped in Perl6 are the typeglobs. Does this imply that I should try as hard to stay away from relying too much on the use of typeglobs in my code? Or, can I still safely use them knowing that they could be easily translated in a Perl6 variant. I guess I wouldn't know the answer until I try initial releases of such a translator, eh? But will it be already too late by the time it's released?

I hope that I didn't sound too hysterical in this post. Do you have similar fears about your legacy code? My worry is I may have to spend more time than I could possibly get (there's only so much time allotted to 'maintenance' at my place of work ;/) to upgrade my legacy Perl5 code to the new Perl6 format.

Please bring on the discussian! ;-)).

Cheers,

- vlad.

"There is no system but GNU, and Linux is one of its kernels." -- Confession of Faith

In reply to Translating Perl5 to Perl6. by vladb

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.