I'd like to take perl6 for a spin. However, other than playing with it I'm not sure how it compares to say python or ruby in terms of strong sides. I mean what are the cases perl6 would shine in comparison? (NOT TO FLAME! I'm asking for ideas to when perl6 would be an interesting tool for the job. AFAIK it had a good string manipulation ~ also I'm still reading the tut and currently it feels very bash and somewhat ugly (although helpful) with the % & @ prefixes).
Great (basic) introduction with exception to the regex chapter because it felt like an introduction to regex instead of the regex features of perl6.
Some things I found interesting (in addition to what s_kilk mentioned and linked to and others have already mentioned some of them)
* Gradual typed!
* Multi subroutine
* Hyphen in variable names
* @numbers.=sort
* .WHAT
* Catch blocks
* .defined
* Unless
It will be fun :)
I however don't understand the reason for the naming of eg elsif, my, slurp/spurt?? (instead of else if or local or fread/fwrite) Is it a perl culture thing? Because they mention in the tutorial that Perl 6 belongs to the C-family languages (and then call the "for" loop in C "loop").
Let me address your last paragraph and expand a bit on what username223 said. elsif is historical from Perl 5; I think it may be related to the fact that C-style ifs require curly brackets in Perl.
my is Perl 5, is different than local, and is gloriously short. Nicest way I've ever seen to declare a variable. :)
slurp/spurt are routines to read/write an entire file at once. slurp is pretty standard in other languages, I believe, and spurt was chosen to be a natural opposite to it. Perl 6 still has open / close / read / write, etc. Though to be fair, honestly I usually use lines, which (with no other arguments) gives you a lazy list of the lines in standard input / files specified on the command line.
for in Perl 5 was some weird combo which could be iterating over an array or a C-style for. In Perl 6, those have been separated. Because iterating over an array is vastly more common, that gets the shorter keyword. The C-style loop got the loop keyword.
> I however don't understand the reason for naming of eg elsif, my, slurp/spurt??
Yes, it's for historical reasons. "elsif" is spelled that way in Perl 5. Perl 5 has both "my" and "local" to specify lexical and dynamic scoping, respectively, so Perl 6 using "local" for lexical scope would be confusing. "slurp" is a common term for reading the entire contents of a file at once.
I am so happy they've included kebab-case identifiers :-) I've always thought they made more sense than camel or snake, because there's no shift key involved. It also brings fond memories of fun in lisp land.
I really like the fact that Perl6 has a proper type system.
I like even more that you can mix static and dynamic typing, so to speak. After taking their sweet time, I am not overly confident about adoption of Perl6, but I hope I'm wrong.
At least, from what I can tell so far, Perl6 manages to keep the spirit of Perl, while fixing a number of things that were wrong, or at least problematic, in Perl5.
Have you looked at the synopses (1)? That's how I've learnt Perl 6, and I've never been convinced by any other kind of Perl 6 documentation. To me the synopses are complete and explanatory enough. As far as problems to solve, there are the various entries in rosettacode (2).
That's a poor example for the documentation to use. In a case like that, kebab notation leads to visual ambiguity when reading code, especially within an expression performing math operations. It becomes harder, at a glance, to tell if the "-" is the kebab connector or if it's subtraction or negation.
Kebab notation makes sense in other contexts, like DOM IDs and CSS class names. It does not make sense in a case like that.
I don't know if any of these features are really unique, but the combination of having them all is certainly unique:
* Strings that are made of Unicode grapheme clusters instead of codepoints or bytes. This means that a substr() operation for example can't even accidentally rip a apart a base character and a combining character on top of it
* Grammars as a language feature
* Gradual typing
* A built-in meta object protocol
* Concurrency based on high-level primitives (promises, queues, supplies, ...) with syntactic support (instead of threads and locks; which are still available if necessary, but discouraged, because they don't compose well).
One that has caught my fancy are various uses of the "Whatever Star". This appears as a * in a few contexts. In many it is really a shortcut for the "Whatever" class, so you can use it in function signatures to enter sort of "automatic mode".
@shuffled_names = @names.pick(*) # randomly pick... however many you have. whatever.
But I think more interesting and different than that is using whatever-star as an automatic lambda thing.
@nums.map(*/2 + 3) # expression-lambda from context around a whatever-star
@nums.map( -> $n { $n/2 + 3 } ) # equivalent with a real stabby arrow lambda
@nums.map( { $^n/2 + 3 } ) # $^n is a generated alphabetical-positional argument
I suppose this isn't really fundamental... but is definitely different.
At first sight I find amusing comparing Ruby to Perl 6.
(a=. sort) (a.sort!)
(a.what) (a.class)
(say a) (puts a)
(for @a=>item) (a.each {|item| ..} )
and the similarities, push, shift, splice, ...
I see nothing new here. But I must say that Perl 6 seems to be easier to learn than Perl 5 for beginners.
A note of caution; it's way better than nothing and will get where it needs to be one day, hopefully in 2016, but it currently uses some awful hacks that make it suck for a lot of stuff.
I don't think anybody can predict the future well enough to answer that.
Languages become part of the standard installation by having very commonly used toos written in them.
I might be wrong, but I'm pretty sure ruby isn't part of a standard Debian installation, and neither is lua, for example. Ruby is very popular for web apps, but you don't need web apps to boot the computer, start a GUI and install packages, so it's not part of the standard installation.
But it's only an 'apt-get install ruby2.1' or so away, and so is rakudo (the current Perl 6 implementation). The debian package in stable is outdated, but work on newer versions is in progress. (Don't know about CentOS, sorry).
Well, I can tell you what's the use of learning Perl 5 and that I suspect most of it will apply to Perl 6 as well:
Perl, more than any other language I know, sacrifices nearly every other property in the name of being useful. It's not a conceptually clean language, or an elegant one, or a simple one, but if you need to get stuff done, now, there is very little that can compete with it.
(At least for some rather specific values of "stuff" - Perl, IMHO, really shines at small-ish scripts that need to convert data from some format to another, or merge data from different sources, especialy when lots of text-handling are involved). Parsing a log file, or matching user accounts from a Windows domain with employee records in an ERP system's database are two examples that come to mind because I had to do those things not too long ago.)
Perl 5 has problems though, especially when it comes to writing large-ish programs. While you can write readable und unreadable code in any language, Perl makes writing unreadable, unmaintainable code easier than, say, Python. Perl 6 tries to fix a lot of this while remaining as useful as Perl 5 (or at least trying to).
I don't know Perl 6. But here's the reasons why I've considered dusting off my Perl 5:
- Subjective, but in my experience, the Perl community is more full of smart yet practical people than any other dynamic language community I've participated or dipped my toe in (and most popular static manifestly typed language communities to boot). I don't say this to trash Ruby or Python (or even JavaScript and PHP, which have plenty of smart users and participants); I just mean that I often learn more from engaging with the Perl folks.
- Kindof a corollary, but Perl 5 seems one of the few places where industry's reflexive treadmill dash towards the newly-formed but usually isocapable turned into a careful reflection on using the existing power at hand wisely and the best marginal gains from key additional features.
Place two jobs in front of me, one of them working on a new Go project, the other on a new Perl 5 project, my bet is going to be that the latter would be part of a more satisfying overall experience.
Now, Perl 6, this is starting to look like a language where they are going to make a number of things easy that most programmers didn't even know were hard, a number of things possible that most programmers didn't even know were possible, where recent PL research is going to meet further practicality, where unicode might even actually be reasonably comfortable to work with.
Well I'm not doing it anymore, but I was using bioperl extensively when I was in biotech, but there were some gotchas and it wasn't as fast as it could be. With better concurrency, that certainly could reduce analysis time.
Currently, I am also using a monitoring tool called Argus (http://argus.tcp4me.com/) which is completely written in perl. It doesn't seem super well maintained, but I really like it, so I have been reading through the source and have been thinking about doing something similar in Elixir, but Perl6 would be a perfect update for it.
Perl is largely a sysadmin tool, in that many of us sysadmins are not formally trained in programming, but we often need to get shit done, and perl enables that. When bash, awk, and sed start to falter, we tend to use python and perl, so that's another use case. Simpler syntax and better threading would certainly help with that.
[+] [-] s_kilk|10 years ago|reply
So far I've gotten the impression it's made by a bunch of smart, friendly hackers who care about quality in their software.
To anyone reading this, I'd strongly recommend casting aside any preconceived notions about perl and giving perl6 an honest shot.
[+] [-] user9756|10 years ago|reply
[+] [-] user9756|10 years ago|reply
Some things I found interesting (in addition to what s_kilk mentioned and linked to and others have already mentioned some of them) * Gradual typed! * Multi subroutine * Hyphen in variable names * @numbers.=sort * .WHAT * Catch blocks * .defined * Unless
It will be fun :)
I however don't understand the reason for the naming of eg elsif, my, slurp/spurt?? (instead of else if or local or fread/fwrite) Is it a perl culture thing? Because they mention in the tutorial that Perl 6 belongs to the C-family languages (and then call the "for" loop in C "loop").
[+] [-] colomon|10 years ago|reply
my is Perl 5, is different than local, and is gloriously short. Nicest way I've ever seen to declare a variable. :)
slurp/spurt are routines to read/write an entire file at once. slurp is pretty standard in other languages, I believe, and spurt was chosen to be a natural opposite to it. Perl 6 still has open / close / read / write, etc. Though to be fair, honestly I usually use lines, which (with no other arguments) gives you a lazy list of the lines in standard input / files specified on the command line.
for in Perl 5 was some weird combo which could be iterating over an array or a C-style for. In Perl 6, those have been separated. Because iterating over an array is vastly more common, that gets the shorter keyword. The C-style loop got the loop keyword.
[+] [-] username223|10 years ago|reply
Yes, it's for historical reasons. "elsif" is spelled that way in Perl 5. Perl 5 has both "my" and "local" to specify lexical and dynamic scoping, respectively, so Perl 6 using "local" for lexical scope would be confusing. "slurp" is a common term for reading the entire contents of a file at once.
[+] [-] imglorp|10 years ago|reply
[+] [-] jrumbut|10 years ago|reply
[+] [-] krylon|10 years ago|reply
I like even more that you can mix static and dynamic typing, so to speak. After taking their sweet time, I am not overly confident about adoption of Perl6, but I hope I'm wrong.
At least, from what I can tell so far, Perl6 manages to keep the spirit of Perl, while fixing a number of things that were wrong, or at least problematic, in Perl5.
[+] [-] peteretep|10 years ago|reply
I want short examples, brief explanations of those, and then some problems to solve.
[+] [-] grondilu|10 years ago|reply
1. http://design.perl6.org/
2. http://rosettacode.org/wiki/Category:Perl_6
[+] [-] thalesmello|10 years ago|reply
[+] [-] stesch|10 years ago|reply
Wow. This will make a few people happy who think underlines and camel case are ugly.
[+] [-] epoch1970|10 years ago|reply
Kebab notation makes sense in other contexts, like DOM IDs and CSS class names. It does not make sense in a case like that.
[+] [-] Sharlin|10 years ago|reply
[+] [-] zimbatm|10 years ago|reply
[+] [-] perlgeek|10 years ago|reply
* Strings that are made of Unicode grapheme clusters instead of codepoints or bytes. This means that a substr() operation for example can't even accidentally rip a apart a base character and a combining character on top of it
* Grammars as a language feature
* Gradual typing
* A built-in meta object protocol
* Concurrency based on high-level primitives (promises, queues, supplies, ...) with syntactic support (instead of threads and locks; which are still available if necessary, but discouraged, because they don't compose well).
* Lazy lists
[+] [-] awwaiid|10 years ago|reply
One that has caught my fancy are various uses of the "Whatever Star". This appears as a * in a few contexts. In many it is really a shortcut for the "Whatever" class, so you can use it in function signatures to enter sort of "automatic mode".
But I think more interesting and different than that is using whatever-star as an automatic lambda thing. I suppose this isn't really fundamental... but is definitely different.[+] [-] doodpants|10 years ago|reply
[+] [-] justinator|10 years ago|reply
For Perl-folk, there is a module to convert between POD and Asciidoc:
https://metacpan.org/pod/Pod::AsciiDoctor
[+] [-] DyslexicAtheist|10 years ago|reply
http://valbonne-consulting.com/job/perl-or-lua-software-deve...
[+] [-] lovboat|10 years ago|reply
I see nothing new here. But I must say that Perl 6 seems to be easier to learn than Perl 5 for beginners.
[+] [-] justinator|10 years ago|reply
The magic is in the more advanced parts of the language. The, "hard things should be possible" parts.
[+] [-] sigzero|10 years ago|reply
[+] [-] raiph|10 years ago|reply
[+] [-] HeadlessChild|10 years ago|reply
[+] [-] perlgeek|10 years ago|reply
Languages become part of the standard installation by having very commonly used toos written in them.
I might be wrong, but I'm pretty sure ruby isn't part of a standard Debian installation, and neither is lua, for example. Ruby is very popular for web apps, but you don't need web apps to boot the computer, start a GUI and install packages, so it's not part of the standard installation.
But it's only an 'apt-get install ruby2.1' or so away, and so is rakudo (the current Perl 6 implementation). The debian package in stable is outdated, but work on newer versions is in progress. (Don't know about CentOS, sorry).
[+] [-] mundanevoice|10 years ago|reply
[+] [-] krylon|10 years ago|reply
Perl, more than any other language I know, sacrifices nearly every other property in the name of being useful. It's not a conceptually clean language, or an elegant one, or a simple one, but if you need to get stuff done, now, there is very little that can compete with it. (At least for some rather specific values of "stuff" - Perl, IMHO, really shines at small-ish scripts that need to convert data from some format to another, or merge data from different sources, especialy when lots of text-handling are involved). Parsing a log file, or matching user accounts from a Windows domain with employee records in an ERP system's database are two examples that come to mind because I had to do those things not too long ago.)
Perl 5 has problems though, especially when it comes to writing large-ish programs. While you can write readable und unreadable code in any language, Perl makes writing unreadable, unmaintainable code easier than, say, Python. Perl 6 tries to fix a lot of this while remaining as useful as Perl 5 (or at least trying to).
[+] [-] wwweston|10 years ago|reply
- Subjective, but in my experience, the Perl community is more full of smart yet practical people than any other dynamic language community I've participated or dipped my toe in (and most popular static manifestly typed language communities to boot). I don't say this to trash Ruby or Python (or even JavaScript and PHP, which have plenty of smart users and participants); I just mean that I often learn more from engaging with the Perl folks.
- Kindof a corollary, but Perl 5 seems one of the few places where industry's reflexive treadmill dash towards the newly-formed but usually isocapable turned into a careful reflection on using the existing power at hand wisely and the best marginal gains from key additional features.
Place two jobs in front of me, one of them working on a new Go project, the other on a new Perl 5 project, my bet is going to be that the latter would be part of a more satisfying overall experience.
Now, Perl 6, this is starting to look like a language where they are going to make a number of things easy that most programmers didn't even know were hard, a number of things possible that most programmers didn't even know were possible, where recent PL research is going to meet further practicality, where unicode might even actually be reasonably comfortable to work with.
[+] [-] s_kilk|10 years ago|reply
We could very well have asked what was the use in learning Go in 2010, but look how that turned out.
Perl6 is currently a very interesting language with a relatively weak module ecosystem. Which is a position many languages have been in before.
Let's not dismiss it out of hand.
[+] [-] peteretep|10 years ago|reply
[+] [-] arca_vorago|10 years ago|reply
Currently, I am also using a monitoring tool called Argus (http://argus.tcp4me.com/) which is completely written in perl. It doesn't seem super well maintained, but I really like it, so I have been reading through the source and have been thinking about doing something similar in Elixir, but Perl6 would be a perfect update for it.
Perl is largely a sysadmin tool, in that many of us sysadmins are not formally trained in programming, but we often need to get shit done, and perl enables that. When bash, awk, and sed start to falter, we tend to use python and perl, so that's another use case. Simpler syntax and better threading would certainly help with that.
[+] [-] ihsw|10 years ago|reply
https://hub.docker.com/_/rakudo-star/
And its GitHub repo:
https://github.com/perl6/docker