6 ms·
Perl 5 isn't a 'cool' language, because it isn't trying to rapidly change itself, instead it just works. I use it just about every day (by my own choice!) and i
by joosters 9y ago
Perl 5 isn't a 'cool' language, because it isn't trying to rapidly change itself, instead it just works. I use it just about every day (by my own choice!) and it can be a fine language to develop in. The libraries available in CPAN contain support for pretty much any task you could think of.
Most of the horror stories that you'll hear about perl are from people who have tried to fix/maintain code that was written badly, which is no different from any other language. You can write horrific or easily-readable code in any language.
Perhaps perl has its reputation because it is often used as a quick kludge to do something that would be just too painful to do in shell script, and novice writers just cut & paste stuff from their searches online to get the job done?
- rootusrootus 9y agoAs a long time Perl programmer myself who has been doing Python for the last three years, I have to say that it is much easier to write unintelligible Perl code than Python. Not that you cannot write some gross things in Python if you try, but the language defaults towards readability and the community strongly encourages it. I recall a great talk a couple years ago at OSCON that Damian Conway gave about how you could essentially turn Perl into a custom language that exactly fit your needs. I walked out of there thinking "wow! That is incredibly awesome, and yet I would never consider it for a business environment." Perl is an appealing language for people who like languages. I count myself as one of those. But I cannot deny that Python makes so much more sense for teams of more than one person.
- pyre 9y agoThe one thing that I miss in Python is true anonymous functions. Perl has them. JavaScript has them. Ruby has them. Python just has lambda functions which can only evaluate an expression.
- btilly 9y agoMeh. In Python you can put a def inside of any scope you want and do anything that you want with it. The fact that it winds up with a name in that scope doesn't stop it from being anonymous everywhere else. At that point the difference is just syntax.
- mixmastamyk 9y agoAnd better clarity---I've seen anonymous callback hell in .js, no thanks.
- pyre 9y agoThat's not a requirement of anonymous callbacks. That's just a symptom of poor coding standards. It can happen in Python too.
- mixmastamyk 9y agoAnd yet the two go hand in hand. Have never seen it in Python, though have never used twisted either.
- pyre 9y ago> And yet the two go hand in hand. It's a tool that can be abused. Saying that the number of tools available should be limited so that they can't be abused seems counter-productive.
- mixmastamyk 9y agoThe trend toward limiting ultimately counter-productive language flexibility is getting stronger, not weakening. See static typing, golang, and functional languages.
- pyre 9y agoYou're declaring the function within that scope. You can do this in other languages too. In Javascript, I can declare a function within a scope too: function myFunc () { var myFunc2 = function () {}; return myFunc3().then(myFunc2); } This isn't some Python-specific thing. > At that point the difference is just syntax. Isn't that the case with most things? If I said that I missed curly braces, that's "just syntax" too.
- pyre 9y ago> instead it just works All of those other languages "just work" too. I'm not really sure what you're getting at with this comment. I worked with Perl 5.x in for 4 years a while ago. It's not as bad as people really think it is. That said, there are a lot of things that can cause you to go wrong. For example: source filters. Super powerful, but if implemented wrong can make debugging a nightmare.
- nf05papsjfVbc 9y agoI think perl invites a kind of mindset from how the language is and how the initial community was. Why does it have something called 'say' instead of something more intuitive like 'println'. Then there are worse examples: carp, cluck, croak. These are commonly used. They are from the same module of course. There is also Moo, Moose. I'm not sure but was there something called 'Mo' too? Commonly used of course but as you can see from the names - you can't tell what they are for. So, I think from some of the choices made in how the language is, it ended up being more drawn towards unreadability than readability by attracting a kind of mindset that wanted it to be 'fun' in a way that only a clique could relate to and now if the language doesn't have broad appeal, I think it shouldn't be that hard for them to accept that fact.
- perigrin 9y agoI'm biased, I've release bits for Moose but ... Django, React, Rails, Spring, : can you tell what they are used for from the names? Does this mean that Python, Javascript, Ruby, and Java are "drawn towards unreadability than readability by attracting a kind of mindset that wanted [them] to be more 'fun'"? In fact Moose, Catalyst, Starman, etc were all projects specifically named more fun _becasue_ their authors saw other communities not naming things "DBIx::Class" or "ExtUtils::MakeMaker" and wanted to bring some of that fun to Perl.
- chromatic 9y agoWhy does it have something called 'say' instead of something more intuitive like 'println'. Why is the Unix command `ls` not `list-directory-contents`? Sure, it's a lot more for everyone to type all the time, but you could get rid of a single line in the man page, meaning the name is much, much more intuitive!
- yellowapple 9y ago"Why does it have something called 'say' instead of something more intuitive like 'println'." 'say' is a lot more intuitive than 'println' for me. In the former case, I'm telling my program to say something. In the latter case, I'm telling it to... print? What if I don't have a printer? And what's a 'ln'? Line? Loan? Loon? In other words, 'println' is not "intuitive". The word you're looking for is "conventional" or "familiar", and it's only either or both of those things if the programmer is coming from a different language. Perl was the first programming language that really "clicked" for me, though, so I'm probably a bit biased there. (as a side note, Perl has a 'print' as well, which actually predates 'say' by a considerable amount ('say' only became a thing in, what, Perl 5.10?). 'say' is pretty much just 'sub say { print "$_[0]\n"; }'.) "Then there are worse examples: carp, cluck, croak." 'carp' and 'cluck' are weird, yeah. 'croak', however, makes sense in the context of 'die'. "There is also Moo, Moose." Both of which feature the letters "oo", which usually stands for "object-oriented". Not as obvious as I'd personally like, but once you spot that it becomes clear that both have at least something to do with Perl5's object system.