2 ms·
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
by AlexanderDhoore 7y ago
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?
- patrickas 7y agoOff the top of my head: Concurrency and parallelism using high level and low level APIs. There is no GIL. 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 }
- cestith 7y agoFour of my favorite things are the built-in MOP, the syntax for declaring values and their traits in objects, hyperoperators, and native support for user grammars rather than just regexes and parsing modules.
- daotoad 7y agoAdd to these multiple dispatch and support for literate programming. 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-your-list-twice/#more-7350 https://perl6advent.wordpress.com/2018/12/16/day-17-checking...