Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Shlomi Fish (918)

Shlomi Fish
  shlomif@iglu.org.il
http://www.shlomifish.org/
AOL IM: ShlomiFish (Add Buddy, Send Message)
Yahoo! ID: shlomif2 (Add User, Send Message)
Jabber: ShlomiFish@jabber.org

I'm a hacker of Perl, C, Shell, and occasionally other languages. Perl is my favourite language by far. I'm a member of the Israeli Perl Mongers, and contribute to and advocate open-source technologies. Technorati Profile [technorati.com]

Journal of Shlomi Fish (918)

Friday April 14, 2006
04:23 PM

Adventures in Pugs-land

[ #29329 ]

So I decided I'd like to write my first Perl 6 program, so I can see what's it like. So I downloaded and compiled Pugs and then started translating my solution to the Graham function quiz-of-the-week. to Perl 6.

So I started the translation. I first translated two small functions, and they did not work as expected. After I logged on to #perl6 on Freenode, and asked around it turned out it was a bug. This bug:

#!/usr/bin/pugs

use v6;

sub func()
{
my $d = [];
if (($d.elems() > 0) && ($d.[0] == 1))
{
return 0;
}
else
{
return $d;
}
}

say "func().perl == ", func().perl;

This function returned the array instead of 0, and I used a variant of it in my code. After noting it, Audrey Tang fixed it, and I was able to proceed.

Then I encountered another bug. :-). Eventually I got a commit access so I can put the bugs test files in the t/pugsbugs/ directory. I found two more bugs, until I finished writing my program. Surprisngly, most of these bugs were pretty basic, and I wonder how people didn't encounter them earlier.

Eventually, after I sorted the expressions' starting sigils, etc. and all the bugs were fixed in pugs, it worked. Sort of - it still had a horrible start-up time and was much slower than its perl5 program. But it worked.

Audrey told me to commit the converted program into the examples directory of pugs where the other quiz-of-the-week. Nothingmuch gave me a lot of commentary on how it can be made more perl6y when he reviewed the code on the channel, but I was too lazy to do anything about it, so I just commited it as is. Hopefully someone will hack on it further while it is inside the pugs repository.

So that's it - now back to perl 5 hacking.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.