Live data from Hacker News

Comparing PHP, Perl, Python and Ruby

hyperpolyglot.org

21–30 of 92 posts

Re: Comparing PHP, Perl, Python and Ruby

#21
post #11

Even though there is no native "switch" statement in Python, the same control flow structure can be done with a dict construct: http://simonwillison.net/2004/may/7/switch/

Whenever the debate comes up in official channels, there is near-unanimous support for omitting it.

Re: Comparing PHP, Perl, Python and Ruby

#23
post #17

[I wonder if this is a personal watershed for Hacker News?] These languages are essentially the same thing. I often write code in at least 3 of these languages most days, and I simply translate the minor differences between them in my head. "Hyperpolyglot" -- excess in many tongues -- I don't think so. Learn at least some static languages, assembler and some functional languages, and then post something interesting o…

Nothing I love more than watching someone try way too hard to act "grizzled" and in the process make an idiot out of themselves.

http://hyperpolyglot.org/

Re: Comparing PHP, Perl, Python and Ruby

#25

This is a wonderful recap of the different ways of expressing the same idea in different languages. It is a fine Rosetta Stone. That being said, it would also be useful to characterize features that are completely unique to a given language. For example, Python has 1) a unique and powerful version of super() for working with multiple inheritance; 2) it has generators (the yield statement) that allows state to be susp…

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, and all kinds of variants on these themes. Extremely clever stuff that Damian Conway would give you a gold star for.

As usual Perl gives you everything you want, unless what you wanted was simplicity or standardization.

Re: Comparing PHP, Perl, Python and Ruby

#29

Earlier quoted context omitted.

The problem with PHP is that 99.99% of the code in circulation today isn't the shinier cleaned-up versions. It's PHP4 and PHP 5.0 and it's still chock-a-block with the storied mind-bending nastiness of yore.

not true at all. Maybe if you're looking at old sites, but PHP5's been out for a long time now, and most of the code in circulation is made for 5.2 or higher. No serious MVC framework, for instance, will run on anything less than 5.2.

Serious MVC frameworks are not the backbone of Wordpress, phpBB or dozens of other hairy monsters that make up the majority of CPU time spent on PHP execution.

I mean Wordpress flat out resisted PHP 5.0 for years. Years. Everything had to be done in PHP4.

Re: Comparing PHP, Perl, Python and Ruby

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

>>The average new Perl programmer is not going to go looking for a library that does object-oriented behavior until it's too late.

Sigh, please don't start language wars by stuff like assuming new programmers sits alone in an ivory tower and don't talk to people, read blogs or browse a new book. (Modern Perl discuss Moose before the old standard, for instance.)

Edit: I'm just not going to touch where you assume all Perl teams that write large code bases are too stupid to agree on best practices. (I'll ask this back instead: Why are there so many language wars-lovers in some open source communities...?)

Post reply on HN