85 points · by fuzzix · 13y ago · 126 comments
...cause the lack of an answer to such a question has only one conclusion: the language is dying, even if this is not already happening in a visible way!
(don't get me wrong, I'm not a Perl hater, and fyi, I think the world would be a much better place if Rasmus Lerdorf would have learned Perl and written a nice Perl web framework instead of inventing PHP :) )
...cause the lack of an answer to such a question has only one conclusion: the language is dying, even if this is not already happening in a visible way!
(don't get me wrong, I'm not a Python hater, and fyi, I think the world would be a much better place if David Heinemeier Hansson would have learned Python and written a nice Python web framework instead of inventing Rails :) )
The Python community is made up of some very smart and talented experts. Their emphasis is on developing high-quality software, and doing things properly. Egos are kept in check, and there are always many people willing to offer a helping hand to those who are new to Python.
The Ruby community is generally quite different. There is a much bigger emphasis on celebrity and ego, and being "trendy". The attitude toward software development is different, too, with much more emphasis on producing a lot of code quickly, even if it has security flaws or other serious problems. It's more about being seen and heard, rather than doing.
I'd put the Perl community somewhere in between the Python and Ruby communities. Back when it was more prominent, it had a more lively set of participants than we than we find in the Python community, but a much higher degree of technical aptitude than we find in the Ruby community.
It sounds like you're talking about the most prolific speakers and code authors in each community who may in fact have their own personalities, but they don't define everyone who are simply using the best tool they can to accomplish their goals.
I like it, but I have given up hopes that one day it will become mainstream.
| Their emphasis is on [...] doing things properly
Too bad that doesn't extend to a better solution to packaging / deployment. :PThat is a really fun -- and typical! -- claim when your GP is a Python troll arguing that another open source language should just die... :-)
Frankly, I've never seen so much language trolls as Python trolls. (And no one needs multi line lambdas and hence real map functions, anyway...)
I don't know much about the Ruby community, but I have a hard time believing they can be worse.
Edit: But sure, the language trolls here might just a few idi... people. There are lots of you with just a few hundreds karma.
People are learning Python? Really? That was probably true in 2006-2009. Python is no longer the new hotness. Scala and Clojure may be.
The fact of the matter is Perl has a massive niche(Text processing, Unicode, CPAN, Regular expressions, Fast prototyping, TIMTOWDI, Ability to add new syntax rapidly[Moose, Devel::Declare etc], Automation, Testing culture, Documentation, Unix, Parsing, Getting things done real fast... I can go on.. but I will stop here), If you look at what Larry Wall has been saying over the years about Perl 6 in various talks you will note that he designed Perl to fill a niche which continues to be totally unoccupied till today's date. The only competitors Perl has in its design space are tools like sed and awk with a additional few Unix utilities thrown around. In other words Perl doesn't have any credible competition. What's more? Any language that is designed to replace Perl will largely look like Perl(Read: Ruby, Perl 6). And yes, Php and Ruby do have their niches.
Python doesn't have a niche. All Python has is- "Tab indent your code." And sorry to break the bad news to you. Merely forcing indentation on a bad programmer doesn't magically transform him to a good programmer. Rather it make the situation more worse. It gives him a free pass to sit amidst good programmers.
For someone who hasn't used any of those, I'd say give each of them a few hours and see which style suits you best. Of course, try to find modern examples to learn from. When it comes to Perl that means:
* Mojolicious [1] (or Dancer [2]) as the web framework
* DBIx::Class [3] as the ORM (maybe with some sugar [4])
* Moose [5] (or Mouse or Moo) as the object system
[2] http://www.perldancer.org/
[3] https://metacpan.org/module/DBIx::Class
It's the only high-level language I know of that only has reference counting for memory management.
It's also the only high-level language I know of that can't really be parsed ("only Perl can parse Perl" they say).
It's a dead language really, you can also see this from the number of noisy evangelists vs. professional users nowdays (and that comes from someone who has used Perl almost exclusively for the past 10 years), if you couldn't see it from the diminishing quality of important modules on CPAN (e.g. I pulled my hair today over JSON::XS generating '-inf' from values on one side and crashing on the other side while trying to parse it).
So, I'm learning Go now and improving my JS skills.
I was bit quite nastily by the lack of garbage collection in Perl just a couple of months into using it.
However, perl proved itself as an invaluable tool for quickly trying out ideas, and I was loyal to it for at least 10 years. Perl just wasn't able to grow as strong as the alternatives did.
I think that Ruby would be a better choice for some of the scripts that come up here and there at work, but inertia keeps much of it in perl. When I've taken the effort to install something for scripting, it has usually been Scala or Groovy, so as to make use of application code within the scripting.
The Perl community is software's Maker subculture [1]. They have a "heck yeah, we'll give that a try" perspective lacking from other subcultures. The the larger software ecosystem ever lost this Maker/Perl worldview, it would be a huge lose.
Taking a step back: In some ways, I think languages get larger adopted because of their culture. Their technical implementation is just a manifestation of the culture. (And, I think this explains why LISP has never broken out. It isn't a language problem, it's a cultural problem).
- efficient and compact regex scripts
- one-liners.
Of course, some of these could be considered a reason NOT to use Perl depending on your specific circumstances.
the only argument I can extract from this is "Perl has a much nicer syntax for working with regexps", and I agree with this (and I hate it when other languages don't fully embrace regexps and treat them as first class citizens).
but that's the thing, not even the "reasons not to use it" are unique to Perl any longer: heck, if you want to write incomprehensible code for "job security" reasons, Ruby gives you enough rope to hang the whole neighborhood (and Python too has a "dark side", but fortunately most people don't know or want to learn about it)
I can open up a text editor and start writing C, or Java, or Perl, or PHP - all without that much thought on whitespace, indentation etc. I can later run indent -kr, or perltidy, or astyle and so forth and make the code I banged out look nice and tidy. Sometimes I feel like doing the nice indentation myself while coding, sometimes I do not and let the scripts do it. With Python "there is one way to do it" and you have to think about indentation while coding. It is annoying. It is like Java and exceptions, forcing me to put try/catch loops everywhere and messing up my scope - even for a little prototype program which will be run once and will never need to catch an exception. It is treating me like I am an idiot and forcing me to work in a regimented manner.
When I first learned Python, at one point I decided to put a do/while loop in my program. I was not able to discover how this was done in documentation. I go on IRC #python and am told Python has no do-while loops (which I later confirmed is true). I was told, and I am assuming the source knows more than me, that this is due to the indentation system. One screwy thing done as a result of another screwy thing.
There are a lot of nice things about Python. The code is clean and understandable. It sometimes allows you to do in 2-3 lines what might take 10 lines in another language. And so on. But some programmers feel certain aspects of it are drawbacks, and these things are not easily dismissable. If they were, they would not be brought up again and again.
while(some_condition):
do_stuffFor most things as an hiring manager I'm OK with people working with their favourite language on whatever project I assign them to (as long as it isn't too esoteric; OCaml is OK, but Haskell is probably pushing it a bit too far, for instance), except when they have to work on an existing code base, in which case I wouldn't want to hire someone hating it; they'd be miserable and the resulting code would be awful.
There are a numbers of things to dislike about Python; however, after you used the language for a while, you realize significant white space isn't one of them. It is like saying lisp's parentheses are ugly: sure, you might not like them, but they are a huge reason the language (and, really, the way of thinking about code) is so powerful.
(Non)Problem solved.
Not to mention you should indent your code exactly the same way (in a consistent format, either tabs or spaces) with how you'd indented Python code.
I'm using Python from time to time, but I wouldn't spontaneously use it for my personal projects, I prefer Perl for that.
The only languages I really wouldn't want to work with is Java.
doesn't
care
how
much
whitespace appears between words, only that there's more than none. Python definitely cares how much.
Don't get me wrong -- I like Python and I use it a lot, but its reliance on syntactically significant whitespace isn't in the plus column.
Python has a few 2.x versions depending on the Distros. Some distros may opted to go 3.x only.
Ruby isn't necessarily universal on NIX systems.
Perl is.
I am currently looking for a couple software developers (https://news.ycombinator.com/item?id=5203736) for positions where Perl is the dominantly used language.
But there are other ways something like a language can die in: no new projects get written in it, no new programmers learn it etc. ...this is a slow "death in silence and darkness" (think Pascal).
It feels closer to Firefox, which is showing some renewed vigor lately, than to e.g. Tcl (sadly…).
This isn't really the only presentation/post about this. After all, it's not like Django and Rails receive the same amount of hype as they did in the beginning, so if you're just going by that, we probably all should switch entirely to Go and Node…
Previously I found that MoooseX::Method::Signatures was very slow, so I ended up selecting Method::Signatures::Simple.
Coupled together, you end up code that looks somewhere between Ruby and Java. It's not my first choice for a new project, but it's not a bad way to fixup an old but large codebase.
Possible code example:
Well worth watching if you still equate "Perl code" with "line noise" :)
At the end of the day the choice is largely personal preference (or company requirement). Also, I know plenty of programmers who still earn a living writing Perl, so it's clearly not a dead language by any stretch of the imagination.
Personally, I would LOVE the chance to work on a Mojolicious project. IMHO that's the best web application framework today (in any language).
I think Perl / Python are interchangeable as a language choice for web scale projects. If your biggest problem is whether to use Python vs Perl vs X, then I say good luck to you -- you should really have more important problems to worry about.
I'd never use ruby for a web scale project (as evidenced by the many services solely dedicated to scaling ruby on rails apps). PHP is not really a language.
Maybe the future belongs to ECMAScript.
I used Perl back around 2000, like everybody else, to make CGIs. Then went away from it for a long time. But I've used Perl over the last year to create a large DMCA takedown system, the bulk of which is spidering and analyzing web pages for infringements. Torrent trackers, one-click file download sites, etc.
It's been a beautiful experience. The code runs quickly (for a scripting language), and CPAN is AMAZING. I feel Perl was the best choice for this project, and since I enjoy the language--and trust me, it's NOT line noise: these aren't little scripts, this package-based, documented, modular software development, the likes of which people normally associate with Java (for instance.
I have to say I disagree with one point in that talk. I don't think there are "too many" ways to do OO in Perl--and this sort of ties into his gripe about "@_" and slurping in subroutine arguments, which I think is pure joy. I'm not certain, but I think Larry Wall got this from Lisp. Please correct me if I'm wrong on my history there.
Anyway, in one package that I use as an object, I have this code:
#/ @param object $this an Offense::Analyzer
#/ @param string $event an EVENT_x constant value
#/ @param int $targetId a target id
#/ @param int $obvious TRUE for obvious offenses, or FALSE
#/ @param int $same TRUE for offenses found on the same target, or FALSE
#/ @return int the value for the given event, or undef
sub getEvent($$$$$) {
my ($this, $event, $targetId) = (shift, getEventFor(shift), shift);
my $obvious = getObviousKeyFor(shift);
my $same = getSameTargetKeyFor(shift);
return undef unless $this->hasTarget($targetId);
$this->{'data'}{$targetId}[$obvious][$same][$event];
}
And I supplement that code with the following convenience getters: sub getIgnored($$$$) { shift->getEvent(EVENT_IGNORED, @_) }
sub getNotified($$$$) { shift->getEvent(EVENT_NOTIFIED, @_) }
sub getQueued($$$$) { shift->getEvent(EVENT_QUEUED, @_) }
sub getRemoved($$$$) { shift->getEvent(EVENT_REMOVED, @_) }
I love the convenience of being able to use the incoming arguments array in this manner. In fact, because you explicitly pass the object reference as the first argument to methods in Perl, I even have this: #/ @param object an Offense::Analyzer
#/ @param string an EVENT_x constant value
#/ @param int a target id
#/ @return int the value for the given event
sub getEventTotal($$$) {
int(getEvent(@_, TRUE, TRUE)) +
int(getEvent(@_, TRUE, FALSE)) +
int(getEvent(@_, FALSE, TRUE)) +
int(getEvent(@_, FALSE, FALSE));
}
Those are not static method calls (so to speak--package sub calls), but are object method calls. I love that convenience.Does your fluency need to be very high for this to seem like a good idea? Probably. And in this manner, Perl can never compete with Python. But I guess my argument is similar to the argument a lot of Lisp dialect programmers make: I'm an advanced user, I don't need to be babysat, I can take care of myself, and I'm ok with exploiting the expressiveness of the language.
why are you mistakenly using prototypes for function signatures
And that goes for my whole coding style. You could easily say it's wrong to use "@_" the way I do, which I feel is incredibly convenient. I'm not saying it's a best practice. Maybe it isn't. But for me, it presents no obstacle, and I feel the code is perfectly clear. In in fact, having to enumerate every single argument merely to pass them along, in the same order, to another sub...to me, that seems like a terrible idea. Some people prefer that verbosity (or clarity, if you like). I don't think it's necessary.
Not noticing it does not equal "nonexistent". Your perceptions do not describe the whole reality.
Any turing complete language can do any job. As long as they are not astoundingly unequal, which is not the case, people choose based on... taste.
Alas, perl 6 in some ways isn't even perl. Perl 6 is cool, but Larry should have made a new name for his next hobby :-)