Perl 6 evaluation

Perl was the first ever scripting language that I picked up. I love it, but I kind of feel constrained by it. I knew about Perl 6 but I had never looked at it before. So I decided to take a look.

Perl 6 project was started 14 ( FOURTEEN !!! ) years ago after the now famous mug throwing incident. Perl 6 itself is a specification for which multiple implementations exist. There are four major (incomplete) implementations right now.

Pluses

  • Class keyword.
  • No flattening of lists.
  • Sigil invariance.
  • Gradual typing.
  • It is claimed that .NET implementation ( Nieceza ) has the ability to call .NET libraries.
  • v5 mode and JVM mode could potentially help Perl 6 code to inter-operate with Perl 5 and JVM code respectively.
  • Feels like Perl 5 ( potentially easier for Perl 5 devs to pick up ? ).

Minuses

  • No IDE support ( It may be hard to write something on Intellij, since only Perl 6 can parse Perl 6 ) ( Only vim syntax highlighting available now ).
  • Very few packages available ( one or two I have tried are bad ).
  • Nieceza seems to be falling behind.
  • Does it have something to constrain TIMTOWTDI ( for example contracts ) ?

Misc

  • Documentation problem is being addressed.
  • Devs on Perl 5 may not care since, contrary to popular belief, Perl 5 development is still going well.
  • MoarVM could be a good fit for client-side apps and one-off scripts and JVM port for server-side/Android.
  • Not a second system ( Perl 5 was an almost complete re-write of Perl 4 ).

How to try

Do not use your Linux distribution’s package.
Use Rakudo Star :
http://rakudo.org/downloads/star/

To install :

sudo perl Configure.pl --gen-parrot --prefix=/opt/perl6
sudo make
sudo make install

Perl 6 binaries, panda (==cpan) and some modules get installed to /opt/perl6
Try out like this :

simula67@hades ~/repos/perl6/1test $ cat test.pl6
#!/opt/perl6/bin/perl6
use v6;
class SampleClass
{
	has $.x is rw;
	method get_x()
	{
		$!x;
	}
}

my $sample_obj = SampleClass.new;
$sample_obj.x = 10;
say $sample_obj.get_x;

simula67@hades ~/repos/perl6/1test $ ./test.pl6 
10

If you love Perl you should definitely check it out.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s