First, the purpose of this tutorial is to show how to translate a real Perl 5 program with typical, often-used statements and code idioms into the equivalent Perl 6 form, and it is not intended to show the advantages of Perl 6. Second, the greater length of the Perl 6 program is due to the extra subroutine required because of a currently non-existent module in the Perl 6 system. Third, I believe the example program's utility, although simplistic, does provide a useful template for many real-world problems.
| [reply] |
Third, I believe the example program's utility, although simplistic, does provide a useful template for many real-world problems.
I make no claim for being especially conversant with P6.
But. I think it is clear from my history here that I am reasonably conversant in P5.
I downloaded your P5 example and ran it. I reformatted it to an acceptable standard. I threw away the superfluous fluff. I trimmed the unnecessary verbosity.
I arrived at < 50 lines of workaday Perl 5 code and ... could see nothing in it that allowed it to demonstrate a single advantage of P6 over P5. Not one.
If your purpose is to promote P6; then take council. Choose an example that exercises P6's strengths rather than it weaknesses. Trim it to its bare minimum. Then ...
Contrast it with the best, most idiomatic, most performent, most clear; most maintainable P5 equivalent you can muster.
My point is: demonstrating that a P6 solution to a non-problem takes more lines of code than a P5 equivalent; does not serve the purpose of persuading those of us suffering from CP6ES (Chronic Perl 6 Expectation Syndrome), that it is time for us to re-evaluate P6.
Bad promotion is worse than no promotion. Doubt my words? Ask Gerald Ratner about his £277.5 million per word apercu; then protest my intervention.
| [reply] |
I downloaded your P5 example and ran it. I reformatted it to an acceptable standard. I threw away the superfluous fluff. I trimmed the unnecessary verbosity.
Please post your version so I can see the error of my ways.
UPDATE 1:
I disagree with the formatting comment. My code
I believe closely adheres to Prof. Conway's style. Also, I do not believe in brevity for the sake of brevity. I never know who's reading my code--most likely
someone with much less Perl knowledge than most monks here.
However, thanks to your comments, I have used perlcritic for the first time and will update the Perl 5 code soon.
| [reply] [d/l] |
UPDATE: Please ignore this redundant and inadvertently added comment.
As stated, the subroutine is there because the File::Basename module is not available yet. I'm sure there's a better way to do it in Perl 6 but this works for now.
| [reply] [d/l] |