Serious question: what does Perl 6 bring to the table? What advantage does it provide over Perl 5, Python 2/3 or Ruby?
I could google this (which I will), but give me the HN summary. What do you think is a good reason to use Perl 6?
I could google this (which I will), but give me the HN summary. What do you think is a good reason to use Perl 6?
Grammars which are like regular expressions on steroids for parsing. ( admittedly still not optimized for speed)
Gradual typing, you can go from no types at all for short one liners, to using built in types, to defining your own complex types for big programs.
subset Positive of Int where { $^number > 0; } #create a new type called Positive
multi factorial(1) { 1 } #multi subroutines that dispatch on type
multi factorial(Positive \n) { n * factorial(n-1) }
#say factorial(0); #Error type mismatch
#say factorial(5.5); #Error type mismatch
say factorial(5); #120
hyper for (1 .. 1000) -> $n { #use hyper indicate for loop can be run in parallel on all available CPUs
say "Factorial of $n is { factorial($n) }"; #Gives correct results by automatically upgrading to big int when needed
}There's also a nice interface for writing command line utilities that takes advantage of the above.
See my Christmas themed 2018 Perl6 Advent Calendar article on the topic: https://perl6advent.wordpress.com/2018/12/16/day-17-checking...