Live data from Hacker News

Differences Between Perl 5 and Perl 6

design.perl6.org

121–127 of 127 posts

Re: Differences Between Perl 5 and Perl 6

#121
post #103
post #90

Earlier quoted context omitted.

> 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…

Meh. Read it as "This is the 6th perl Larry's designed". It is the one after 5, in that sense. The naming is not perfect but it is, at this point, a little late to do anything about that.

But the other five aren't different languages, they're different versions of the same language. (And if it weren't for the Perl 6 debacle I think what we currently call Perl 5.22 would be something like Perl 6 or even Perl 8 or 9.)

Re: Differences Between Perl 5 and Perl 6

#122
post #106

Earlier quoted context omitted.

Not quite true! A good faith effort was made for compatibility. But it was not perfect. Hence http://www.perl.com/doc/FMTEYEWTK/perl425.html was created to let people know where the problems were.

Well sure and even in Perl 5's lifetime there have been depracations. But you're nit-picking. The majority of Perl 4 code ran under Perl 5.

Most did. But enough didn't to make it a major migration.

Re: Differences Between Perl 5 and Perl 6

#123
post #99

Earlier quoted context omitted.

On #1 we agree. We don't agree on #2. Inline::Perl5 is better than I would expect, but there is still an issue. For example, Perl 6 uses garbage collection instead of reference counting so modules like http://search.cpan.org/dist/ReleaseAction/lib/ReleaseAction.... no longer work like they did in Perl 5. (Yes, that module is used in production code. And I happen to know of several independent re-creations of the same…

While I grant you there are probably modules with problems, I will state for the record that I don't consider any module that relies on specific undefined behavior that could stop functioning as expected due to a regular Perl 5 point release to be the problem of Perl 6. If Perl 5 could break or change its functionality by changing exactly when they deal with reference counting and destroy objects, then it's a time bo…

...module that relies on specific undefined behavior...

You call Perl 5's use of reference counting "undefined behavior"?

It has been documented behavior for as long as Perl 5 has existed. The resulting destruction mechanics have been relied on by the core module http://perldoc.perl.org/SelectSaver.html for the same time. Furthermore any interesting XS program is likely to make use of the relevant macros SVREFCNT_int and SVREFCNT_dec.

Therefore this is NOT something that can be changed in a point release. It is a fundamental part of how Perl 5 works. And the fact that it is a fundamental incompatibility with Perl 6 plans is something that people have been aware of for a decade.

Re: Differences Between Perl 5 and Perl 6

#124
post #44

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.

IMHO Perl 6 will not catch on / be even mildly successful without a clear upgrade path from Perl 5. The ask for people to use Perl6 is a huge one given it's basically a completely different beast that just resembles Perl5. Without pointing out where Perl6 excels (in comparison to Python/Ruby not Perl5) this will probably be a non-starter for most people. (this is from somebody who did his fair share of Perl5 in the o…

> IMHO Perl 6 will not catch on / be even mildly successful without a clear upgrade path from Perl 5.

Why can't it be successful based on its own merits?

Go didn't have a clear upgrade path from anywhere. Rust doesn't, nor do Julia and all the other new, hip languages that I just forgot about.

Re: Differences Between Perl 5 and Perl 6

#125
post #123

Earlier quoted context omitted.

While I grant you there are probably modules with problems, I will state for the record that I don't consider any module that relies on specific undefined behavior that could stop functioning as expected due to a regular Perl 5 point release to be the problem of Perl 6. If Perl 5 could break or change its functionality by changing exactly when they deal with reference counting and destroy objects, then it's a time bo…

...module that relies on specific undefined behavior... You call Perl 5's use of reference counting "undefined behavior"? It has been documented behavior for as long as Perl 5 has existed. The resulting destruction mechanics have been relied on by the core module http://perldoc.perl.org/SelectSaver.html for the same time. Furthermore any interesting XS program is likely to make use of the relevant macros SVREFCNT_int…

> You call Perl 5's use of reference counting "undefined behavior"?

No, I call counting on the fact that items with no references will be reclaimed (triggering DESTROY) immediately when they go out of scope undefined behavior. The fact that it happens very fast in most cases because it's reference counted and not garbage collected is not something that should be counted on. In fact, I'm pretty sure there are cases where in very tight loops, DESTROY isn't called immediately on scope end. I vaguely recall having to deal with that problem (but it could just as likely been a bug of mine that appeared to indicate that until I found it).

Re: Differences Between Perl 5 and Perl 6

#126
post #123

Earlier quoted context omitted.

...module that relies on specific undefined behavior... You call Perl 5's use of reference counting "undefined behavior"? It has been documented behavior for as long as Perl 5 has existed. The resulting destruction mechanics have been relied on by the core module http://perldoc.perl.org/SelectSaver.html for the same time. Furthermore any interesting XS program is likely to make use of the relevant macros SVREFCNT_int…

> You call Perl 5's use of reference counting "undefined behavior"? No, I call counting on the fact that items with no references will be reclaimed (triggering DESTROY) immediately when they go out of scope undefined behavior. The fact that it happens very fast in most cases because it's reference counted and not garbage collected is not something that should be counted on. In fact, I'm pretty sure there are cases wh…

Followup, since it's too long since my reply to edit:

How are you assuming Inline::Perl5 works? Did you look into it and these are issues you found, or are these from how you assume it works?

Inline::Perl5 spins up an embedded perl5 interpreter (libperl I assume), and handles the data marshaling transparently. I assume (having not looked too closely at it's implementation), that it's sort of like a reverse XS. It looks into the perl5 guts, runs perl5 code, and exposes variables and functions to Perl 6. I see no reason to assume it wouldn't be using SVREFCNT_int and SVREFCNT_dec or equivalents as needed on scope changes to handle this.

In fact, looking at the Inline::perl5 repo now, it appears they are doing quite a bit with the refcnt functions[1].

1: https://github.com/niner/Inline-Perl5/search?utf8=%E2%9C%93&...

Re: Differences Between Perl 5 and Perl 6

#127
post #120

Earlier quoted context omitted.

It's not a smell if you are doing an asston of text munging. Rather than write one ginormo regex I prefer a sequence of short actions. It's easier to debug and reason with.

Use named captures or list assignment. $1 $2 etc are already a code smell in Perl 5. Action-at-a-distance is the enemy.

That's needlessly verbose if I am descoping $1 within a line or two. I agree one must be careful.
Post reply on HN