Skip to content

Instantly share code, notes, and snippets.

@arnsholt
Last active December 16, 2015 05:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arnsholt/219bafc22a55fac09e21 to your computer and use it in GitHub Desktop.
Save arnsholt/219bafc22a55fac09e21 to your computer and use it in GitHub Desktop.

Title: Rakudo Perl 6: New (old) kid on the JVM block

Abstract

The long in development Perl 6 project has finally arrived on the JVM!

After a long gestation period, the Perl 6 project is now in a state where early adopters can experiment with the compilers and write libraries in the language. Perl 6 iterates and improves on several key features: Regular expressions, famously incapable of parsing HTML, are replaced with grammars. Grammars have far more readable syntax, easily parse the same languages as ANTLR, and are easily composable and extended with inheritance. Classes can define custom operator behaviour, or even export custom operators (without confusing code that isn't aware of them).

A long standing pain point of Perl 5 is object-orientation. In Perl 6 this problem goes away. Everything's an object, new classes are defined without the boilerplate required in Perl 5, and with the new mixin functionality, proper factoring of functionality is easier than ever. And of course, objects and classes are easily introspected and modified with the meta-object protocol. Closely related to the object system is the new type system.

Perl 6 isn't statically typed or dynamically typed; as a gradually typed language, it lets the programmer pick the point on the spectrum that best suits the problem at hand. Since the language has a proper type system, other features follow naturally. From this type system, multimethods are a natural feature to add. These are similar to Java's polymorphic methods, but rather than determining the candidate to call at compile-time, multimethods are dispatched at run-time. This means that code like event loops can be written using simple and transparent code, with the language handling the type-based dispatch. Using multimethods, Perl 6 also makes parsing command-line arguments dead simple (goodbye getopt!).

Highlights

  • Real live Perl 6 code, running on the JVM today.

Expected audience

  • Old Perl programmers
  • New Perl programmers
  • Anyone with an interest in JVM-based scripting languages

Tags

  • Alternative languages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment