Perl 6‎

Warum brauchen wir eine neue Programmiersprache wie Perl 6? Haben wir nicht schon genug Programmiersprachen? Jetzt kommt Perl 6.

Perl 5

New featues (1/2)

New featues (2/2)

Killer features (1/3)

Killer features (2/3)

Killer features (3/3)

Formal parameters to subroutines

https://en.wikibooks.org/wiki/Perl_6_Programming/Subroutines

Simple type definition

(* = whatever)

    subset NonNegativeInt of Int where * >= 0;

    sub fib (NonNegativeInt $nth) {
        ...
    }

    subset NonEmptyString of Str where *.chars > 0;

    method set_name (NonEmptyString $name) {
        ...
    }

Gradual typing

(not static typing and not dynamic) fails at compile time

    sub foo (Int $n) { ... }

    my Num $bar = 3;
    foo($bar);

Default to rational numbers

    if .1 + .2 == .3 {
        say "yes";
    }
    else {
        say "no";
    }

    1 / ( .1 + .2 - .3 ); # results in 1/0 and not in error

http://0.30000000000000004.com/

Complex numbers

http://www.harmonyware.com/perl/p6numerics/

Junctions

https://en.wikibooks.org/wiki/Perl_6_Programming/Junctions

OO, limit, setter, getter

class Point {
    subset PointLimit of Rat wehre -10,0 .. 10.0;
    has PointLimit $.x is rw is required;
    has PointLimit $.y is rw is required;
}

http://blogs.perl.org/users/ovid/2015/09/fluent-interfaces-in-perl-6.html

Working with thread pool

    use JSON::Tiny;
    sub MAIN($file1,$file2) {
        my $parsing1 = start form-json(slurp($file 1));
        my $parsing2 = start form-json(slurp($file 2));
        my ($parsed1, $parsed2) = await $parsing1, $parsing2;
        say $parsed1 eqv $parsed 2
            ?? 'Files contain identical JSON'
            :: 'Files contain different JSON';
    }

Infinite lazy lists

https://en.wikibooks.org/wiki/Perl_6_Programming/Lazy_Lists_and_Feeds

Grammar examples

Inline::Perl5 https://github.com/niner/Inline-Perl5/

Inline (C) https://github.com/FROGGS/p6-Inline-C/

Inline::Python https://github.com/niner/Inline-Python/

Inline::Lua https://github.com/raydiak/Inline-Lua/

Multi dispatch

https://en.wikipedia.org/wiki/Multiple_dispatch#Perl_6

Awesome Unicode support

Perl 6 strings are NFG (Normal Form Grapheme).

https://rdstar.wordpress.com/2013/07/22/some-thoughts-on-unicode-in-perl-6/

http://unicode.org/reports/tr29/

Hyperoperators

https://en.wikibooks.org/wiki/Perl_6_Programming/Meta_Operators

Macros

https://perl6advent.wordpress.com/2012/12/23/day-23-macros/

Run Perl 6

C:\rakudo\bin>perl6 -e "say 'Hallo world!'; say 5 ~~ 1 .. 1e999999;"
Hallo world!
True

C:\rakudo\bin>

Perl 6 Error message

C:\rakudo\bin>perl6 -e "say 'Hallo world!'; say 5 ~~ 1 .. 1e999999x;"
===SORRY!=== Error while compiling -e
Confused
at -e:1
------>  'Hallo world!'; say 5  ~~ 1 .. 1e999999x;
    expecting any of:
        whitespace

C:\rakudo\bin>

Contest

http://bits.works/

Diskussion

weitere Quellen (1/6)

http://perl6.org/

http://perl6intro.com/

weitere Quellen (2/6)

I read
https://www.quora.com/Perl-programming-language-1/Should-I-be-interested-in-Perl6/answer/Curtis-Poe

Yes of course, but it's divided in many many posts. Let's stay with Curtis Poe for a moment, just recently he wrote this:
https://www.quora.com/Perl-programming-language-1/Why-did-Larry-Wall-finally-ship-Perl6-and-does-anybody-care/answer/Curtis-Poe?srid=OB5p&share=1

weitere Quellen (3/6)

Why did Larry Wall finally ship Perl6, and does anybody care? Curtis Poe's answer:

weitere Quellen (4/6)

in the Guidelines for the Perl6 page on Facebook, I mentioned some links. Some contain answers to your question.
https://www.facebook.com/notes/perl6/guidelines-rules/1659022847697401

weitere Quellen (5/6)

For instance, these pages:

weitere Quellen (6/6)

Ende