Sunday, May 31, 2009

Perl 6!

I feel bad bugging people for help with Perl 6, especially when you're simply trying to compile the damn thing. Chromatic goes on and on about how doing lots of releases is really important for something to be viewed as "alive" and "progressing". I dunno. I waited with glee for the Parrot 1.0 announcement to go out, and then fumbled until this last week to get Rakudo running on my mac. No big deal, I'm an early adopter. I believe in Perl, and I know that it is going to rock when it's finished, so dealing with the headaches to get it set up are worth the trouble. But, not everyone is like me.

Anyway, I just wanted to point out this one VERY cool thing (in my eyes) that was like the second or third test program I wrote.. Heck, I'd love to make this into a test for the test suite if it isn't covered... (it addresses a weakness that Perl 5 had, that was documented)..

my $foo = "1f9";
$foo++;
say $foo;
$foo--;
say $foo;

This spits out...
1g0
1f9
A perl 5 equivalent will say...
2
1
But Perl 5 supports a simpler increment system (sort of)...

$foo = "f9";
$foo++;
print $foo . "\n";
$foo--;
print $foo . "\n";
This dumps out:
g0
-1
Hooray Perl 6!

(I found the test for this, it's S03-operators/autoincrement.t, it doesn't cover the "1f9" case, which doesn't work in Perl 5). I'll see if I can get commit bit access to this test next week!

No comments:

Post a Comment