News for hackers. Stuff that matters.
Re:Perl 6 Introduction by user9756 on Saturday November 28, 2015 @08:29AM (#10641001)
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").

Re:Perl 6 Introduction by colomon on Saturday November 28, 2015 @03:12PM (#10642238)
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.

Re:Perl 6 Introduction by username223 on Saturday November 28, 2015 @08:38AM (#10641011)
> 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.

Re:Perl 6 Introduction by omaranto on Saturday November 28, 2015 @02:08PM (#10641992)
"my" is shorter than "local" or "let" and fairly evocative. Maybe you should ask why other languages don't use "my", instead. :P
Re:Perl 6 Introduction by cafard on Saturday November 28, 2015 @09:30AM (#10641134)
"my" arrived after "local". The former is true lexical scoping, the latter isn't quite.
Re:Perl 6 Introduction by tbrownaw on Saturday November 28, 2015 @11:29AM (#10641470)
Right. As gp says, "local" is dynamic scoping.

It's available as long as the declaration stays on the call stack. It more-or-less allows globals to be temporarily redefined.

Re:Perl 6 Introduction by DonHopkins on Saturday November 28, 2015 @02:10PM (#10641998)
Think locally, act globally.