News for hackers. Stuff that matters.
Re:Perl 6 is fun by atrust on Monday November 30, 2015 @12:54PM (#10650686)
I loved Perl 5. Now when Perl 6 is out, I'm a bit confused about versioning. As far as I understand, perl 6 files are of .pl6 extension. Why would that be different from regular .pl, giving that it's just a new version of a language? I mean, I have never seen things like .js5, .php6, etc. Next, is `use v6;` mandatory? Quite confusing. Am I allowed to do `use v2;`?
Re:Perl 6 is fun by zoffix222 on Monday November 30, 2015 @01:10PM (#10650756)
Your confusion lies in thinking, as you've said, "just a new version of a language." It's actually been a long, 15-year journey that resulted in a completely brand new language. The name is still 'Perl 6' for historical reasons, but it may as well be called 'Rakudo'; something people've not heard of yet. The Perl 5 language is still being developed and improved, with a major release every year. Hence, the filename distinction.

However, it's just a convention. You can have any extension you like (at least on *nix).

And to answer your question, no "use v6" is not mandatory. It's there so if you run your script with a perl (and not perl6) interpreter, you won't get confusing errors.

Re:Perl 6 is fun by atrust on Monday November 30, 2015 @01:58PM (#10651015)
Of course one can have any extension. Not that it's a bad thing to use .p6. I was just trying to make it clear for myself to understand how beneficial the new extension is. Part of that lies in "marketing" the language. Old school engineers may still want to use .pl, whereas newbies will follow the documentation and have their files prefixed with .p6. My worry is that such behavior may lead to a confusion in Open Source world and push away newcomers from using the language.

I've been following the journey for, more or less, the past 10 years. I hope that whoever spent those 15 years on developing Perl 6, will reap the rewards.

Re:Perl 6 is fun by sigzero on Monday November 30, 2015 @05:01PM (#10652210)
Most of the modules I have seen are using .pm6 and .pl6.
Re:Perl 6 is fun by atrust on Monday November 30, 2015 @06:06PM (#10652543)
Re:Perl 6 is fun by grondilu on Monday November 30, 2015 @01:06PM (#10650732)
The extension is not mandatory. Usually people use .p6, but you can also use .pl . Notice that I've never seen .pl6.

'use v6;' is not mandatory either, but it allows your program to display an helpful error message if you try to run it with the perl 5 interpreter. Try "perl -e 'use v6;'", you should get:

    Perl v6.0.0 required--this is only v5.20.2, stopped at -e line 1.
    BEGIN failed--compilation aborted at -e line 1.
'use v2;' will not run with the Perl 6 interpreter, but 'use v5;' will work, as the Perl 6 interpreter is specced to be able to run Perl 5, albeit with certain limitations (no XS, for instance).
Re:Perl 6 is fun by cygx on Monday November 30, 2015 @02:13PM (#10651089)
Notice that I've never seen .pl6

Check your Rakudo's tools folder.

Re:Perl 6 is fun by atrust on Monday November 30, 2015 @01:12PM (#10650764)
Understood. Thanks! I might have confused .p6 with .pl6. Thanks for the clarification on that.
Re:Perl 6 is fun by MadcapJake on Tuesday December 01, 2015 @12:19AM (#10653780)
`use v6;` actually means "use the latest version of Perl 6". I believe you can even do `use v6.b` and other versions to target specific releases of Perl 6, though I'm not sure if that's implemented yet.

Some text editors also will change to a Perl 6 highlighter if this pragma is present.

Re:Perl 6 is fun by cygx on Monday November 30, 2015 @02:17PM (#10651107)
I have never seen things like .js5, .php6, etc.

Some Fortran people do it.