[Purdue-pm] learning Perl 6

Mark Senn mark at purdue.edu
Tue Oct 2 07:41:18 PDT 2018


I contacted Purdue Libraries yesterday to see if they will add _Learning
Perl 6_ to their collection.  See
    http://shop.oreilly.com/product/0636920062776.do
for more information about _Learning Perl 6_.  No word back yet.

Perl 6 is a much better programming language than Perl 5 in my opinion.
To use Perl 6 effectively and efficiently you'll need to know how Perl 6
signatures work.

I suggest first reading, _An Introduction to how subroutine signatures
work in Perl 6_ at
    https://opensource.com/article/18/9/signatures-perl-6
(The
    # Perl 5
    frobnicate( bar => 42 );
    it will pass two values, "foo" and 42,
typo has already been reported.)

Let your brain rest, and then skim _class Signature_ at
    https://docs.perl6.org/type/Signature
Don't worry if you only "get" a tiny fraction of this on the first reading.
Note the
    sub f(Real $x where { $x > 0 }, Real $y where { $y >= $x }) { }
line, one can also define
    sub f(Real $x where { $x <= 0 }, Real $y where { $y >= $x }) { }
to deal with cases where $x <= 0.  Using multi-methods to deal with
different types or values of arguements is much nicer than having
to write code to deal with all the cases in my opinion.

It's clear to me that programming in Perl 6 is going to save time and
produce better, self-documenting code than in Perl 5.  Rhetorical
question: how long do you want to wait before saving time?

-mark


More information about the Purdue-pm mailing list