Live data from Hacker News

Differences Between Perl 5 and Perl 6

design.perl6.org

51–60 of 127 posts

Re: Differences Between Perl 5 and Perl 6

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

[deleted]

Re: Differences Between Perl 5 and Perl 6

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

This is entirely a naming problem. Calling it "Perl 6" implies that it's a linear descendent of Perl 5, which it most certainly is not. Perl 6 is something else entirely. Which would be fine, if the name indicated that. But it doesn't, which is perverse. The name implies something different than what the product actually delivers.

It's the "New Coke" (see https://en.wikipedia.org/wiki/New_Coke) situation all over again. When Coca-Cola rolled out New Coke back in the '80s, lots of people actually preferred the taste of the new formulation to the original, "classic" Coke. But it failed anyway, because it came in a can labeled "Coke" but tasted very different than what people thought the contents of a can labeled "Coke" would taste like. Their brains never made it to the "hey, this tastes better!" part, because they were too busy raging over thinking they were getting one thing when they were actually getting another.

It's been clear for more than a decade now that Perl 6 was going to be a big, discontinuous change instead of an incremental step up from Perl 5, so why they've persisted with calling it "Perl 6" all this time is beyond me. Just call it something other than Perl and 90% of the gripes about it will vanish overnight.

Re: Differences Between Perl 5 and Perl 6

#53
post #35

Earlier quoted context omitted.

There's a specific reason why length was deprecated, and the error, which gives alternatives, may give some insight: # perl6 -e 'my $string = "foo"; say length $string;' ===SORRY!=== Error while compiling -e Undeclared routine: length used at line 1. Did you mean 'elems', 'chars', 'graphs', 'codes'? Perl 6 tries to get unicode right. In doing so, it makes a distinction between characters, elements, codepoints and gra…

That does shed some insight into why a generic Length is missing, but I agree with the sentiment that it is counter intuitive. It does not read right on a quick scan, and I think this is especially important in softly typed languages. If I see string.chars I expect to see a bucket of char, and not the count of chars. That name needs to be more explicit.

It's terse which is another curse or benefit of Perl. The less terse method name would be string.numchars or string.charcount.

Re: Differences Between Perl 5 and Perl 6

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

Just keep that codebase in Perl 5? Perl 6 isn't a replacement for Perl 5. It's a whole new language. Perl 5 is still actively maintained and used.

> Perl 6 isn't a replacement for Perl 5. It's a whole new language.

...with an exceedingly poorly chosen name.

(Which is not to diminish how good it is as a language.)

Re: Differences Between Perl 5 and Perl 6

#55
post #35

Earlier quoted context omitted.

There's a specific reason why length was deprecated, and the error, which gives alternatives, may give some insight: # perl6 -e 'my $string = "foo"; say length $string;' ===SORRY!=== Error while compiling -e Undeclared routine: length used at line 1. Did you mean 'elems', 'chars', 'graphs', 'codes'? Perl 6 tries to get unicode right. In doing so, it makes a distinction between characters, elements, codepoints and gra…

That does shed some insight into why a generic Length is missing, but I agree with the sentiment that it is counter intuitive. It does not read right on a quick scan, and I think this is especially important in softly typed languages. If I see string.chars I expect to see a bucket of char, and not the count of chars. That name needs to be more explicit.

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.chars I expect to see a bucket of char

Why? Is that an expectation that comes from some other language? There's only so much you can expect a language to follow the semantics of other languages. Perl 6 will have it's own quirks, expecting it to conform to some malleable standard based on what some percentage of other languages do is not something I think is entirely fair to expect.

Re: Differences Between Perl 5 and Perl 6

#56
post #22
post #11

Was: my $len = length($string); Now: my $len = $string.chars; My intuitive interpretation of that syntax would be "given a string, return a sequence containing its characters, in order". Or is that overlading on return type, and do you get the behavior I would find intuitive if one assigns to an array? Even if that is true, I find that ugly. I would prefer more explicit code, for example my $len = $string.chars.#; Si…

Every Perl expression has a context, and context is as central to Perl as types are to some other languages. It's first chapter material in any Perl book. It's not "overloading on return type" strictly speaking, but that's what the syntax looks like. An array (of characters in your example) in a scalar context is the length of the array. I don't know if that's whats happening here, but that's how you do it everywhere…

Perl6 doesn't do this. A function doesn't know if it's being called in scalar or list context.

(I think there might be some movement towards letting a function detect sink (void) context. Then functions with both side effects and return values don't need to calculate the return values when they aren't needed.)

Re: Differences Between Perl 5 and Perl 6

#57
post #55

Earlier quoted context omitted.

That does shed some insight into why a generic Length is missing, but I agree with the sentiment that it is counter intuitive. It does not read right on a quick scan, and I think this is especially important in softly typed languages. If I see string.chars I expect to see a bucket of char, and not the count of chars. That name needs to be more explicit.

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

I think it's a poor selection.

s always has denoted some sort of collection to me and I'm sure you'll see many people have the same confusion.

Re: Differences Between Perl 5 and Perl 6

#58
post #47

Earlier quoted context omitted.

Ha, what happens when one is 'trouted'?? It's been a number of years, and I can't check right now, but I believe that the amount of code in Perl6 is actually less than in Perl5. The amazing power that is Perl6 naturally falls out of a whole lot of experience and fantastic design decisions. Not to mention several great implementations. I'm a big fan of 'less is more' as well. In this case, you're literally correct: Pe…

I expect it's based on the /slap emote in IRC. Wikipedia [0] has a page on it, from which I swipe the follwing: `When someone does something inadvisable that they had the experience and intelligence to avoid, you may likely see the suggestion that they be "trouted"` Trout slapping originated in 1995 with internet relay chat (IRC). While in an IRC chat room, the IRC client mIRC would allow users to enter the command:…

Wow, that's a blast from the past. Did it really originate in mIRC? Somehow I feel like it predated that, but maybe just because I didn't run Windows.

Re: Differences Between Perl 5 and Perl 6

#59
post #55

Earlier quoted context omitted.

That does shed some insight into why a generic Length is missing, but I agree with the sentiment that it is counter intuitive. It does not read right on a quick scan, and I think this is especially important in softly typed languages. If I see string.chars I expect to see a bucket of char, and not the count of chars. That name needs to be more explicit.

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 class specifically; examples include (from Str): univals, lines, words, ords

chars is the odd man out here: charcount or something similar would have been a lot cleaner. (Yes, its consistent with elems, but that seems to be poorly chosen for the same reason; its a plural name, but it provides a single numeric value.)

Re: Differences Between Perl 5 and Perl 6

#60
post #47

Earlier quoted context omitted.

I expect it's based on the /slap emote in IRC. Wikipedia [0] has a page on it, from which I swipe the follwing: `When someone does something inadvisable that they had the experience and intelligence to avoid, you may likely see the suggestion that they be "trouted"` Trout slapping originated in 1995 with internet relay chat (IRC). While in an IRC chat room, the IRC client mIRC would allow users to enter the command:…

Wow, that's a blast from the past. Did it really originate in mIRC? Somehow I feel like it predated that, but maybe just because I didn't run Windows.

It sounded Monty Python-ish to me, and it looks plausible[1].

1: https://www.youtube.com/watch?v=WsfiD78Cy0s

Post reply on HN