Live data from Hacker News

Differences Between Perl 5 and Perl 6

design.perl6.org

1–10 of 127 posts

Re: Differences Between Perl 5 and Perl 6

#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 items and verbally calling them scalars and so on. Urbit is cool but is most famous for feeling the need to rename everything.

Here's a slide stack for going from MOOSE (more or less the most popular "real" perl5 OO implementation, technically an "add on" for perl5 although many people will only program perl5 with MOOSE) to perl6 OO. At least toward the middle there are adjacent slides of "this is how you do it in MOOSE" "this is how you do it in perl6"

http://www.slideshare.net/lichtkind/p6-oo-vs-moose-moo

I'd like to read a book titled something like "Modern Perl; For Perl 6.0"

The transition will be such fun; I have some business logic libraries where I'll have to replicate behavior and test suites simultaneously for awhile in MOOSE/5.0 and in 6.0.

(response to unfortunately hellbanned berntb question about replication, the codebase is huge and interrelated and can't be forklift upgraded all at once; its already non-trivial to do stuff in both perl and scala, and now it would be perl5 perl6 and scala all more or less interoperating)

Re: Differences Between Perl 5 and Perl 6

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

It might be too much stress or too little coffee, but I don't understand the last part. Why would you need to replicate behaviour and tests?

You mean it will take time before you trust the "use Perl 5 code in Perl 6" bridge that is worked on, so it isn't enough to run the Perl 5 tests and then use that code in Perl 6?

(Or you think there will be bad interactions with Moose and Perl 6 OO?)

Edit: Huh, I was shortly un-hellbanned and am Hellbanned again since the previous comment didn't live up to some interesting-level standard? :-)

Re: Differences Between Perl 5 and Perl 6

#7
post #2

One thing that bugs is that perl5 code could potentially run with perl6. Is there any mitigation for that?

It was explicitly not a design goal to be backwards compatible.

"In exchange for breaking backwards compatibility, at least at the language level, Perl 6 offers plenty of high-powered language concepts that Perl 5 didn't support..."

http://www.perl.com/pub/2006/01/12/what_is_perl_6.html

Re: Differences Between Perl 5 and Perl 6

#8
post #2

One thing that bugs is that perl5 code could potentially run with perl6. Is there any mitigation for that?

Any Perl 6 code will have to include a `use v6;` instruction at the very top of the file, so there's no chance of Perl 5 code being confused for it. Is this what you mean?

EDIT: this was completely wrong, see below.

Re: Differences Between Perl 5 and Perl 6

#9
post #2

One thing that bugs is that perl5 code could potentially run with perl6. Is there any mitigation for that?

It was explicitly not a design goal to be backwards compatible. "In exchange for breaking backwards compatibility, at least at the language level, Perl 6 offers plenty of high-powered language concepts that Perl 5 didn't support..." http://www.perl.com/pub/2006/01/12/what_is_perl_6.html

That's not what I read the GP post as saying though. Rather, that the perl 6 interpreter could run code written as perl 5 (and never ported). With their different semantics, the results would be unpredictable and often undesired.

Re: Differences Between Perl 5 and Perl 6

#10
post #8
post #2

One thing that bugs is that perl5 code could potentially run with perl6. Is there any mitigation for that?

Any Perl 6 code will have to include a `use v6;` instruction at the very top of the file, so there's no chance of Perl 5 code being confused for it. Is this what you mean? EDIT: this was completely wrong, see below.

`use v6;` is not mandatory in Rakudo. Off the top of my head, I don't think it's mandatory in theory in Perl 6, either. However, it is widely used to mark Perl 6 code, because it gives you a nice clean error message if you accidentally try running it in Perl 5.
Post reply on HN