If you want to build and run Perl 6 today, you first check out parrot:
svn co https://svn.perl.org/parrot/trunk parrot
A basic incantation for then building Perl 6 would be as follows (doing this from memory, so let me know if I've goofed):
$ cd parrot/ perl Configure.pl && make test cd languages/perl6 make perl6 && ./perl6 -e 'say "Hello, World!"'
I was getting plenty of strange failures with make perl6 until chromatic pointed out that I likely had a previous parrot installed on my system. Sure enough, a few locates, greps and rms later, I did a make realclean and make perl6 and everything worked beautifully.
And then my very first program failed.
sub fact (Int $n) { if 0 == $n { return 1; } else { return $n * fact($n - 1); } } say fact(5);
Even though Perl 6 understands types, I'm told that $n - 1 is returning a Num, not an Int, thus causing a runtime exception. They're working on it.
That being said, I'm quite impressed with how much actually works. If you really want to see more, you can type make spectest_regression and that will check out the tests from Pugs (remember Pugs?) and run them. Lots of them pass and you can search through the tests to see the impressive amount of code which actually works. Perl 6 is coming along nicely. Big shout-outs to chromatic, Patrick Michaud, Jonathan Worthington, Moritz Lenz and far too many other people to list. There is light at the end of the tunnel.
If "make perl6" fails, try this instead:
cd languages/perl6/
make
That doesn't build an executable, just a bytecode file (perl6.pbc). It's not so easy to run, but it works more reliably.
(The executable is really just as wrapper that links parrot and contains the byte code. Sadly that wrapper isn't very table yet)
Re:And if "make perl6" fails...
chromatic on 2008-06-25T18:01:45
(The executable is really just as wrapper that links parrot and contains the byte code. Sadly that wrapper isn't very table yet.)It's almost exactly the same code as the
parrot
executable, with two differences. First, it doesn't load external bytecode. Second, it performs a full shutdown of the Parrot interpreter when the process exits.The latter occasionally finds memory management errors. I enabled it for that reason -- but these are rare. I've seen (and fixed) one in the past two months.
Generally any problems with the fakecutable are the same as problems with the
parrot
executable as well.Re:And if "make perl6" fails...
moritz on 2008-06-25T18:41:45
If the executable wrapper mostly reveals underlying problems, and doesn't
cause too many on its own, maybe we should use it for running the tests.I already get some memory management failures (at least sometimes) in the
rakudo tests, it would be a good idea to expose them.Re:And if "make perl6" fails...
chromatic on 2008-06-25T19:48:39
If the executable wrapper mostly reveals underlying problems, and doesn't cause too many on its own, maybe we should use it for running the tests.Add the
--leak-test
flag toparrot
for the same effect; that option enables the same internal option as the fakecutable.
more accurately put, the spectest_regression target runs a subset of the official perl 6 test suite, which is stored in the pugs repository. those tests known to be passing are in the spectest_regression target, so the rakudo implementors can make sure their changes have not broken any existing code.
the official perl 6 test suite lives under http://svn.pugscode.org/pugs/t/spec/. the pugs repository is a good fit for the official test suite because of the liberal commit policy there. anybody can get a commit bit, and add tests.
a conversion of existing pugs tests, which live under http://svn.pugscode.org/pugs/t/, is underway, but the tuit supply is low. this is a great place for folks to help *all* the perl 6 implementations by migrating tests from pugs to the official test suite.
if anyone is interested in helping, please mail perl6-language@perl.org, or poke me, moritz, or auzon in #perl6 on irc.freenode.net.
… is like this:
sub fact ( Int $n ) { [*] 1.. $n }
(I’ve no idea if that actually works in the current state of Rakudo.)
Re:Of course, the right way to write that...
Ovid on 2008-06-25T15:56:06
No, the right way to write that is:
subset PosInt of Int where { $_ > 0 }
sub fact ( PosInt $n ) { [*] 1.. $n } :)
Re:Of course, the right way to write that…
Aristotle on 2008-06-25T16:11:54
:-) (Actually, that should be
>=
– factorial is defined for zero.:-)) Re:Of course, the right way to write that…
Aristotle on 2008-06-25T16:13:54
Hmm, except
1
won’t work right, so then it needs to be.. 0 [*] 1
, which is a little uglier, though manageable... min( 1, $n ) Re:Of course, the right way to write that…
polettix on 2008-06-26T15:45:47
Maybe you meant max instead of min?Re:Of course, the right way to write that…
Aristotle on 2008-06-26T16:48:28
Err, yes.