[ art / civ / cult / cyb / diy / drg / feels / layer / lit / λ / q / r / sci / sec / tech / w / zzz ] archive provided by lainchan.jp

lainchan archive - /λ/ - 20794

File: 1481776418809.png (56.25 KB, 261x243, camelia-logo.png)


I was thinking about picking up a scripting language, and after trying out Python and Ruby, realized that I never considered Pearl as an alternative.

What is lainchans opinion on Perl 6? It seems to receive a lot of hate, I can't say much about it myself, except that Perl code looks foreign to me upon first look.



I've been looking at it as well.

I'm a Perl 5 guy (not a guru or anything, but it's my go-to scripting language) and Perl 6 looks like it cleans up a lot of the warts from Perl 5. I hope it catches on.

I don't think I'd recommend it as a first language, but if you're already familiar with other languages and you're on UNIX, give it a try. If you're not on UNIX, don't bother - it will just seem bizarre to you.


I'm going to be starting to learn Perl tomorrow after my last exam before the holidays. should I learn 6, or is 5 still the default. Bear in mind I'm learning Perl for CV boosting as much as the fun of learning a language.



Perl 5 is still the standard on UNIX. It has the most 3rd party library support on CPAN.

Perl 6 may or may not be the future. I'm hoping it will - Perl needed a good cleanup - but at this point who knows? PHP and Ruby took the web away from Perl, and Python took away the small application space.

If you get a job working with Perl, it'll most likely be Perl 5. If you aren't looking to work with it and don't have any specific needs outside a general purpose language, learn Perl 6.


I should check out that ~~trash~~ modern scripting language. Perl 5 and the OO everything but terribly and thru CPAN kinda made me despire Perl, it's a comfy regex engine but large projects always seem like a headache with it.

You can't staple tentacles to a dog and call it an octopus.



The goal of Perl 6 was to clean up the implementation while keeping the language "Perly." The OO system in Perl 6 is a lot different than the one in Perl 5, which was a tacked-on mess.

I still haven't used it myself, but from the docs I've read it seems a lot cleaner. How much that will help for large projects is unclear, though.


File: 1481844552001.png (103.52 KB, 141x200, perlhacking.png)

I learned programming through C, Java and Haskell, this is why I was looking to add a simple scripting language to my repertoire. That language you use to quickly hack together a prototype, or a small script to sort your files, scrape a website etc.

So far I used Python for this purpose, but somehow I do not really like it, which is why I never properly learned it.

Do you guys think Perl could serve as a nice helper language?



Perl's pretty UNIXy. It was originally designed to replace awk and make shell scripting easier.

It's quite a bit different than the languages you listed. It'll feel sloppy.

That said, I use it for prototyping, and it works well for that purpose. Unless you've got a specific reason to learn Perl 5, you'd probably want Perl 6.


> large projects always seem like a headache with it.
I like Perl a lot, but because I always use it for small to medium-size scripts. I don't see myself using it for a large project though, unless. And I don't understand how people do that, besides "because they can"

> The OO system in Perl 6 is a lot different than the one in Perl 5, which was a tacked-on mess.
The OO system in Perl5 was just fine, or rather, the half-OO it implemented was good enough. It was intuitive and it used Perl primitives simply. But OO users kept wanting their paradigm fully implemented in the language so they actually integrated OO.

What I like about Perl5 is that it's not overly complicated (syntax notwhitstanding, and not even then). You have $scalars @arrays and %hashes and also \references and &routines for more powerful constructs. You just put together those primitives in usually straightforward ways.

I was going to suggest Racket because muh lisp.
That said, yeah, Perl can do the job, if you're interested in the capabilities of Perl, peek at Higher Order Perl. Really good book.
Read this for a comparison of Perl and Scheme.


File: 1481863019142.png (46.1 KB, 153x200, learningpearl6.png)

> I was going to suggest Racket because muh lisp

Racket is pretty fuarking awesome, I used it to work through the Schemer series, and played around with it a bit afterwards, solving some euler problems, but even though it offers a lot and has batteries included (and I will surely play around some more with it in the future), I dont think it satisfies my scripting wishes.

I took a closer look at Perl 6 and was actually surprised, as foreign and weird as it looked to me at first glance, as easy it was actually to pick up and write my first few lines, gonna play around with it some more.

Since I do not have much interest in Perl 5, do you think it would be wise to work through some Perl 5 resources, translating them to Pearl 6 on the fly, as a beginner?



I dunno about that. Reading through the documentation, there's all kinds of little incompatibilities in the syntax between 5 and 6. Whitespace is handled differently, sigils don't work the same, etc. See the 5->6 overview on the Perl6 site for details.

That's going to be the hardest part for me. The bigger changes will be easy, but the small ones look like a real minefield.

Unless you're going to be working on Perl 5 programs or need to port a CPAN package, I'd stay away from it. I suggest you make sure you have Perl 6 under your skin before you go and mess with old Perl 5 code.


I love perl. Not for everything, but it is probably the best language in existence for text processing, and using regexes there is a blast compared to pretty much any other language. While it's possibly the easiest language to write unreadable code in, it's also possible to write perfectly readable code in it. My biggest perl project had ~12kLOC of perl in it and was still pretty readable.

But perl6 kinda lost me. Actually, it lost me at having operators that are some bizarre unicode symbol. I just can't fathom why anyone would think this is a good idea.

It's so fuarrrking non-standard they have a manual page about how to type them in:

Should I even bother with perl6?



Reading that page, it looks like the unicode symbols are optional. There are ascii equivalents listed below them.

I can see this as being handy for math and logic stuff. I use unicode characters in my personal scheme code for various greek letters, dot product, cross product, etc.

I'm willing to bet that if no one has yet written a de-unicodifier for perl6, someone will soon.


As they said before me, you probably don't want to touch Perl5 if you don't have a specific reason to do it.
Perhaps it yet doesn't have as many libraries as Perl5.
But they are different languages altogether and are regarded as such.
Perl6 is supposed to be better, it was just my opinion that I prefer Perl5 for the reasons mentioned



> unicode operators

It seems to me as well as if they are an entirely optional feature. Its just that the Perl6 creators appear to be pretty proud/happy about them (Im not judging).


I fuarrrking hate Racket. The batteries are nice, but the stdlib is trying to implement, like, 8 paradigms at once: it makes CL look uncluttered.

Chicken's my go-to Lisp at the moment, it being essentially the polar opposite of Racket, but still having good libraries.

I wouldn't reccomend either for scripting, though. My scripting languages of choice would have to be AWK and Ruby. Or maybe JS.

Another promising candidate for scripting (although I haven't had time to evaluate it yet) is TXR (http://www.nongnu.org/txr/), which seems to be what happens when a Lisp hacker looks at AWK and Perl and thinks "I can do better than that." So it not only has the standard regex support, but also its own recursive pattern matching language, which is a lot cleaner, and does a good job parsing complex structures.

And if you really hate lisp, TXR can also emit the bindings from the pattern match as a collection of POSIX shell variable bindings to be `eval`ed.