Live data from Hacker News

Differences Between Perl 5 and Perl 6

design.perl6.org

81–90 of 127 posts

Re: Differences Between Perl 5 and Perl 6

#81
post #46

Earlier quoted context omitted.

This is not weak typing. Perl (both 5 and 6) use operators to define type context. It's entirely unambiguous whether you want to add something or concatenate strings because they are different operators . "1" + "1" # 2 "1" . "1" # 11 (~ to concatenate in Perl 6) 1 + 1 # 2 1 . 1 # 11 When you perform a string operation on a numeric type, it stringifies the number, when you do a numeric operation on a string, it numeri…

Ah, sorry. Despite having used Perl for years, I'd forgotten how much emphasis it puts on concepts that invoke a high cognitive load.

PHP and other languages have a . vs + distinction.

I would say that the one area where you're right, and you are so very right, is context. Have %/@/$ cause such chaotic (and not terribly consistent, at least outside the core libraries) behavior changes was not worth the improved error messages or cool tricks you can do with it.

This is coming from someone who really likes Perl (5) both in practice and philosophically.

Re: Differences Between Perl 5 and Perl 6

#82
post #41
post #4

Note that its more or less "how to write perl 5 in perl 6" Sorta like the old F2C, Fortran to C, converter. You don't get idiomatic C, but you do get a fortran program that compiles and runs as a C program, more or less. Some parts of perl6 are annoyingly urbit-y, come on, you guys just had to rename ARGV and rename scalar and the for-foreach transition is ridiculous. I suspect at least a decade of people pointing at…

In Perl 5, for and foreach have been aliases for eachover for a very, very long time. # perl -E 'foreach (my $i=0; $i I never use foreach in Perl 5, and that's what I'm paid to write in. This is just a reaffirming that "for" is the preferred syntax (and this isn't a TMTOWTDI thing, this is two reserved words for the exact same code construct thing). Moose, interestingly enough, is based on backporting the then-propos…

Though to be fair, for the last year or so, every time I've needed to hack on a p5 script for $work, my first step has been to convert it to p6. It usually is pretty quick for 50-100 line scripts, and generally it's a lot easier to reason about changing the code once it's in p6.

Re: Differences Between Perl 5 and Perl 6

#83
post #55

Earlier quoted context omitted.

I think you are speaking from unfamiliarity with the language and possibly bringing baggage from other languages. In Perl 6, chars is the number of characters in a string, and elems, which is inherited from the Any role, exists on many objects and means the number of elements, as that makes sense for that object. Perl 6 is not softly typed, it's gradually typed. It's as hard as you want to make it. > If I see string.…

> Why? Is that an expectation that comes from some other language? No, the convention that (thing that can be viewed as a collection of subelements in several different ways).(plural name for one kind of subelement) is a property/method providing a collection of the subelements of the named type is not only common in other languages, it is also quite common in Perl 6 -- and even followed (aside from chars) in the Str…

In the code I'd make I'd always call these nchars and nelems and it would be intuitively clear (to me too one year after I wrote the code), but Perl 6 seems to like to mess with the accustomed minds. Renaming "for ( ; ; )" which was structurally identical to the C one to the "loop" is easy. Somebody also mentioned renamed ARGV to *ARGS. Examples aplenty.

It seems this and a lot of other details were intentionally made to clash with our habits, as I write in my other comment.

Re: Differences Between Perl 5 and Perl 6

#84
post #15

To reuse the recent slogan, the only thing that changed is everything. It's a new language with its own internal logic. I used (and still use) Perl 5 because it made some specific things easy to make (various processing of data). I still don't know for which kind of tasks Perl 6 is the best choice. But maybe the language is simply too young for it to be obvious?

Perl6 is really a strict supserset of Perl5 in this way. Perl6 is at least as good as Perl5 for everything Perl5 is good at. But Perl6 is way, way more than that.

Perl6 is at least as good as Perl5 for everything Perl5 is good at.

No. It is not. Don't believe me? Here is a short list of classic selling points for Perl 5 that Perl 6 clearly loses on.

1. Performance. Back in the 1990s, Perl hit a sweet spot of being quick for development while still being fast enough for a wide variety of tasks. It still performs reasonably well versus other scripting language. Every time I looked at Perl 6 it failed to be fast enough for anything interesting to me.

2. Library support. Any argument for Perl quickly lists CPAN. It is a large part of why people adopted it in the first place. Perl 6 loses to every major language, including Perl 5, on this. If you need to do anything from connect to a database to sending email, Perl 6 loses.

3. Backwards compatibility. Perl has a history of being careful with backwards compatibility, starting with Perl 1's unit test suite back in the mid-80s. (It would be decades until other language communities caught up.) Most organizations currently using Perl 5 use it because they already have existing code in Perl 5. Their primary motivation for staying on Perl is that they don't want to rewrite their code. Perl 6 requires a rewrite of their code.

Re: Differences Between Perl 5 and Perl 6

#85
post #66

Earlier quoted context omitted.

Perl 6 developer here. Perl 6 is not an automatic upgrade path from Perl 5. We don't expect anybody to rewrite huge amounts of Perl 5 code in Perl 6. Perl 5 is going to be maintained separately. We do provide tools to augment Perl 5 code with Perl 6 code, and the other way around. There's Inline::Perl5 for Perl 6, and Inline::Perl6 for Perl 5.

Is there a Perl 5 EOL being discussed? Or, if Perl 5 and Perl 6 really are two completely separate languages separated by a similar syntax, then what comes after Perl 5 in the Perl 5 language? Will it forever be 5.N, 5.N+1, ...? (And, I guess, will there forever be 6.N, 6.N+1, ...?)

In my opinion, no, an EOL is not being discussed.

What is being discussed is the excitement brewing from the all the work that has transpired via the Modern Perl movement.

We have modern web frameworks (Mojolicious, Dancer, PSGI/Plack); YEARLY releases of Perl 5; CPAN has never been easier to work with (cpanm, cpanfile, carton); a healthy and supportive community; and modern infrastructure to work with OO (e.g. Moose).

There are several of other things I haven't mentioned.

For example, if you want to try a web app with one of the latest perls:

  $ curl https://raw.githubusercontent.com/tokuhirom/Perl-Build/master/perl-build | perl - 5.20.3 /opt/perl-5.20

  $ curl -L https://cpanmin.us | /opt/perl-5.20/bin/perl - App::cpanminus Mojolicious

  $ /opt/perl-5.20/bin/mojo generate lite_app all_the_awesome.pl

  $ /opt/perl-5.20/bin/perl all_the_awesome.pl daemon
... Goto a browser and visit http://127.0.0.1:3000

The above command assumes you have a system perl that can bootstrap your user perl into /opt/perl-5.20.

Thank you for asking.

Re: Differences Between Perl 5 and Perl 6

#86
post #84

Earlier quoted context omitted.

Perl6 is really a strict supserset of Perl5 in this way. Perl6 is at least as good as Perl5 for everything Perl5 is good at. But Perl6 is way, way more than that.

Perl6 is at least as good as Perl5 for everything Perl5 is good at. No. It is not. Don't believe me? Here is a short list of classic selling points for Perl 5 that Perl 6 clearly loses on. 1. Performance. Back in the 1990s, Perl hit a sweet spot of being quick for development while still being fast enough for a wide variety of tasks. It still performs reasonably well versus other scripting language. Every time I look…

1. Can't argue with this.

2. With Inline::Perl5[1] this should be a non-issue. The short code snippet in the README at the github repo referenced should give you the idea.

3. Having not been released yet, Perl 6 has zero history on backwards compatibility, so there's no way to assess whether it's relatively better or worse than Perl 5.

That said, I don't necessarily support the original statement that Perl 6 is a superset and at least as good as Perl 5 at everything. I just wanted to address your specific statement regarding library support.

1: https://github.com/niner/Inline-Perl5

Re: Differences Between Perl 5 and Perl 6

#87
post #66

Earlier quoted context omitted.

Perl 6 developer here. Perl 6 is not an automatic upgrade path from Perl 5. We don't expect anybody to rewrite huge amounts of Perl 5 code in Perl 6. Perl 5 is going to be maintained separately. We do provide tools to augment Perl 5 code with Perl 6 code, and the other way around. There's Inline::Perl5 for Perl 6, and Inline::Perl6 for Perl 5.

Is there a Perl 5 EOL being discussed? Or, if Perl 5 and Perl 6 really are two completely separate languages separated by a similar syntax, then what comes after Perl 5 in the Perl 5 language? Will it forever be 5.N, 5.N+1, ...? (And, I guess, will there forever be 6.N, 6.N+1, ...?)

perl5 is a language name - its current release is version 22.

I presume perl6 will be doing similarly.

Re: Differences Between Perl 5 and Perl 6

#88
And Perl6 has now invented its own word, "twigil"? Sigil was already a bad enough word. I used Per5 for a ton of production code years ago, and I've met Larry Wall and he is a brilliant and friendly person, but I am sad to say there is absolutely zero chance of Perl6 being adopted for a serious production software project, probably ever. It doesn't bring new capabilities, it's just different, and in a mostly-worse way.

Re: Differences Between Perl 5 and Perl 6

#89
post #66

Earlier quoted context omitted.

Perl 6 developer here. Perl 6 is not an automatic upgrade path from Perl 5. We don't expect anybody to rewrite huge amounts of Perl 5 code in Perl 6. Perl 5 is going to be maintained separately. We do provide tools to augment Perl 5 code with Perl 6 code, and the other way around. There's Inline::Perl5 for Perl 6, and Inline::Perl6 for Perl 5.

Is there a Perl 5 EOL being discussed? Or, if Perl 5 and Perl 6 really are two completely separate languages separated by a similar syntax, then what comes after Perl 5 in the Perl 5 language? Will it forever be 5.N, 5.N+1, ...? (And, I guess, will there forever be 6.N, 6.N+1, ...?)

No, there won't be EOLs for the foreseeable future. For all purposes, you can imagine Perl 6 being called language XYZ. Even though 15 years ago, Perl 6 was envisioned as the next version of Perl 5, that is no longer the case. Perl 5 and Perl 6 are both actively-developed, modern languages—different languages, in the same family. Perl 5's latest release was just about 47 days ago and Perl 6's first release will be on Christmas.

Re: Differences Between Perl 5 and Perl 6

#90
post #86
post #84

Earlier quoted context omitted.

Perl6 is at least as good as Perl5 for everything Perl5 is good at. No. It is not. Don't believe me? Here is a short list of classic selling points for Perl 5 that Perl 6 clearly loses on. 1. Performance. Back in the 1990s, Perl hit a sweet spot of being quick for development while still being fast enough for a wide variety of tasks. It still performs reasonably well versus other scripting language. Every time I look…

1. Can't argue with this. 2. With Inline::Perl5[1] this should be a non-issue. The short code snippet in the README at the github repo referenced should give you the idea. 3. Having not been released yet, Perl 6 has zero history on backwards compatibility, so there's no way to assess whether it's relatively better or worse than Perl 5. That said, I don't necessarily support the original statement that Perl 6 is a sup…

> Having not been released yet, Perl 6 has zero history on backwards compatibility, so there's no way to assess whether it's relatively better or worse than Perl 5.

Well, uh, it's not backwards-compatible with Perl 5. Yes, yes, I know, "It's a different language." So why is it called "Perl 6?" The name is very much designed to tell us "this is the one after Perl 5." Insisting that everyone evaluate it as a greenfield language is an incredible insistence upon cognitive dissonance.

Post reply on HN