Live data from Hacker News

Comparing PHP, Perl, Python and Ruby

hyperpolyglot.org

81–90 of 92 posts

Re: Comparing PHP, Perl, Python and Ruby

#81
post #80

Earlier quoted context omitted.

Was that in response to his exhortation to learn different languages, or do you actually believe that Perl and its self-proclaimed successors have any profound differences?

I think the point is that while the article link is to the scripting category, the site does in fact cover a lot more languages.

Yeah, that was the first point. You can see a lot more variety of comparisons in the main page. The categories are a bit odd at times, but it's a good stab at being representative.

Re: Comparing PHP, Perl, Python and Ruby

#82
post #78

Very good comparison between all the languages, and like other people said: a nice Rosetta stone. With that said, it would be very useful to add a comparison of the database layer syntax as that it is, at least for a me, a common task in all of the scripting languages. I also agree with the comments about adding the features that are unique to the languages, as that would be extremely helpful.

there are quite a few options for syntax already in the mix, that people noticed already. If we will add DB-related stuff, it will confuse even more - too many options available in each language.

Re: Comparing PHP, Perl, Python and Ruby

#83
post #62

Earlier quoted context omitted.

I agree with another comment in reply to yours that this is a tired argument. But ignoring that; someone who is new to programming is not going to understand the value of any of these concepts anyway, so it doesn't matter that they don't discover them immediately. At about the same time people figure out how to do OO cleanly, they will start hearing about libraries too. If you were to navigate a largish Perl codebase…

Fork Perl 5, package it so that Moose is default, and call it Perl 7.

If you want Python, just use Python ("There should be one-- and preferably only one --obvious way to do it." - PEP 20). Very central to the Perl philosophy is that TIMTOWTDI (though I'm not sure if this is canonized anywhere as clearly as for Python), so your suggestion is ridiculous. I for one found the bless mechanics extremely enlightening with regard to the semantics of object orientation. The feeling I had when I first got that was akin to when I first realized "to be" lumps together the semantics of identity and attribution in the english language.

Re: Comparing PHP, Perl, Python and Ruby

#84

PHP repl is actually php -a

Note that this is not a traditional repl in the style of of Python or IRB that evaluates each line individually. With php -a you have to enter an entire script, and then exit to run it, and which point you can no longer interact with the variables, etc. Also it's super backwards in that you need to add If you really want a repl that's useful for PHP check out http://www.phpsh.org/ by Facebook.

Re: Comparing PHP, Perl, Python and Ruby

#85
post #25

Earlier quoted context omitted.

That being said, it would also be useful to characterize features that are completely unique to a given language. Perl has all these features. 1) a unique and powerful version of super() for working with multiple inheritance Perl (with Moose) has before, after, around, override, and augment in addition to super. And, it has "Roles" so you don't have to resort to hacks like multiple inheritance to implement mixins or…

It also means you have to stumble upon Moose to start using objects in a reasonably sane way. The average new Perl programmer is not going to go looking for a library that does object-oriented behavior until it's too late. They'll probably have some crazy idea that the language should be doing OO for them. If you were to navigate a largish Perl codebase today, you'd encounter the old-school bless, Moose trickiness, a…

I used to work on an old perl code base that was written by well meaning new programmers. I know work on an old python code base written by well meaning new programmers.

Both projects suck equally. The python project is much newer (~4 years instead of 12), but the smell is about the same. The problem with new programmers isn't that they pick the wrong object creation patterns, but that they reinvent the wheel and write long stupid functions with horrible nested if/else statements. A former google employee worked on one of the projects, and wrote her own python to json function.

I like python, and I like perl, but the python culture sucks. It has this weird superiority complex where it rejects any external ideas. If I am talking to perl people, and I mention some kick ass python feature that I miss, I either get information as to how it can be done in perl, or interest into why I like it. Around python people, I generally get something like, "well, none of us know perl. Have you tried doing it the python way?"

Moose is awesome, perlbrew is awesome, perl's module culture is awesome. The module culture is the one that annoys me most often. Python programmers don't write as good of tests, or nearly as good of documentation. We still have to run a lot of python 2.4, and a lot of modules claim 2.4 support and then use 2.6+ syntax.

I like python, I think it is a much better matlab, but a lot of its syntax is unintuitive and stupid, and there are some serious cultural issues. Anyone who thinks that it is perfect, or better than another language in every way is holding it back.

Re: Comparing PHP, Perl, Python and Ruby

#86

Earlier quoted context omitted.

I'm not a Perl programmer, but I'm aware of Moose. It's frequently mentioned in beginner tutorials on how to do OO.

You mean Moose being mentioned in Non-Perl beginner tutorials? That's interesting! Do you happen to have some links to those tutorials?

No, I mean Perl tutorials like Modern Perl.

Re: Comparing PHP, Perl, Python and Ruby

#87
post #78

Very good comparison between all the languages, and like other people said: a nice Rosetta stone. With that said, it would be very useful to add a comparison of the database layer syntax as that it is, at least for a me, a common task in all of the scripting languages. I also agree with the comments about adding the features that are unique to the languages, as that would be extremely helpful.

there are quite a few options for syntax already in the mix, that people noticed already. If we will add DB-related stuff, it will confuse even more - too many options available in each language.

Great point! Thanks for the response, and it makes sense.

Re: Comparing PHP, Perl, Python and Ruby

#89
post #75
post #69

Earlier quoted context omitted.

I wonder what they mean by security testing? What exactly are they testing and how? BTW given that there's no security patches released for 5.2 anymore (while bugs are still being found and published of course) - their understanding of security is certainly unorthodox.

I retract my security testing statement. The are currently testing if 5.3 is stable on their servers and have no ETA for the upgrade :-(. This was in mid October.

I think this is more about not pissing off random untechnical customers that haven't bothered to update their off the shelf blogging software since 2005. Guess the tipping point is when they are losing more customers not upgrading than they will upgrading.

Re: Comparing PHP, Perl, Python and Ruby

#90
post #19
post #6

Note that anywhere you see array() in that list for PHP 5.4 you can replace it with [ ]'s. So the example that has: $a = array(1,2,array(3,4)); becomes: $a = [1,2,[3,4]]; Also 0b101010 works in 5.4.

True, but PHP 5.4 doesn't even have a stable release yet & many people haven't even adopted 5.3.

Today, PHP 5.4 are released as stable.
Post reply on HN