Hacker News new | past | comments | ask | show | jobs | submit login

Sure, it scales. But it isn't a very good language. (The word "blub" comes to mind.)

Here are features I like to have (in no particular order):

  * lexically-scoped variables (and closures)
  * lambdas
  * continuations
  * macros
  * an object system with a MOP (PHP and Java fail miserably here)
  * powerful regex engine (can be added via libraries, so not too critical)
  * extensive module library
  * flexibility (I want to write code my way, not the way someone else thinks I should write it; bye bye, Python.)
Things that are nice to have:

  * multiple dispatch OO
  * partial evaluation
  * laziness
PHP has none of these features. That's why I don't use it and don't recommend it. And oh yeah... PHP is a templating system too. I would rather get that as a library, not a core feature. (But I won't count that against them.)

So what language does have all these features? None :)

But, Lisp and Perl are good compromises. CL does everything except continuations and having a decent module library; Perl does everything except have pretty syntax and macros. Sadly neither of those languages has (by default) the "optional features", which is a shame. I ranted about this on my blog:

http://blog.jrock.us/articles/Syntax%20and%20features.pod

Anyway, PHP is junk in terms of a programming language. It's fine if you don't know how to program, don't know what abstraction is, and don't like using libraries.




Your list of features has nothing to do with getting things done. They are almost completely academic.


True of maybe half of those features...but the other half? Well, if you don't know enough to miss them, I don't have any way to argue with you--there's no common language in which we can converse about them.

But, I feel uncomfortable every time something I write takes two or three times the lines of code because of what the language lacks. First class functions or lambdas, closures, and a good library fall into this category...and PHP fails on all of them (there are many PHP libraries, but most are buggy and rather scary, and the standard library has ad hoc'ery written all over it...I like for the standard library to at least be a little bit planned out rather than crammed in via 3000 or so functions in the same name space).

But PHP is a perfectly valid language for many classes of problem. Just be careful not to use it for the classes of problems for which it is extremely poorly suited.


>Well, if you don't know enough to miss them, I don't have any way to argue with you--there's no common language in which we can converse about them.

While I agree with your actual premise ; this statement is pretty bad form. It is the logical equivalent of a Christian saying that in order for me to critique his faith, I must become a Christian.

Replying, "you wouldn't know; you're an imperative programmer" is moot; maybe he is an imperative programmer - but he could also be correct. There is no connection between the two. Deductive logic has never been allowed in the scientific method, which is, ultimately, the barometer of truth.

I'm aware that Graham is the originator of this somewhat popular meme, but it's a wrong popular meme. The nature of ignorance of certain desirable features can only explain why people don't immediately demand them; it doesn't prove their usefulness.


"Replying, "you wouldn't know; you're an imperative programmer" is moot"

That's obviously not what I said. My reply was, "If you believe all of the features listed above are useless in a real world development situation, I'm not capable of convincing you otherwise, as we're going to be speaking very different languages". I think there is a difference, though I can see how it comes off as arrogant. It wasn't really intended that way--I'm not a great programmer, and never claimed to be. But I know what makes me (as an adventurous, but not necessarily brilliant, hacker) more productive is good tools. And first class functions, closures, and a great set of libraries (like that found in Perl, Python, and to a lesser degree Ruby), are the tools save me lots of time. When I develop in PHP, and I do so pretty frequently, I miss all of those features constantly and my code is longer, less readable, and harder to maintain.

My point was if you haven't worked with a language that has those features you wouldn't be aware of how much time, and how many lines of code, they can save you. I'm not a smug lisp weenie pushing the blub paradigm (though there is definitely something to the argument) or implying that imperative developers are the scum of the earth. I'm a pragmatic sort of fellow...if it works, use it. But if something works better, why not use it instead?

That said, one of the places where PHP is a perfectly valid language is web applications. Some of the largest applications in the world run on PHP--Facebook, many Yahoo sites, etc. But they also have lots of languages doing the non-frontend work, because PHP is really horrible at a lot of backend tasks. Data and systems management, for example, where Perl and Python, or Java (depending on scale and performance requirements and existence of libraries), would be a better choice.


Sorry, I didn't mean to characterise you wrongly, I only rephrased the actual quote because it fitted better with the deconstruction. I actually do think it's a reasonable representation of what you said (or, more pointedly, the concept in general).

Good reply, looks like I made a mistake about part of your opinion, but I can't agree with you about not being the value of these features being difficult to explain. I always just explain situations where closures/anonymous functions work well (while I'm not much of a web programmer, I can think of a couple of examples). I agree, there is something to the blub concept. There certainly is a spectrum of languages.


Certainly not. I've used every feature in his list, except partial evaluation in a real program. Partial evaluation would have helped immensely, but it wasn't available in any language I've used. I admit that continuations weren't really necessary, but they do make code with backtracking much easier to read.


Back to Trollinton with you.


And here we have an architecture astronaut. Once you get out of academia and start programming in the real world, you'll realize that there are other considerations for determining which programming language to use besides a robust feature set.

So go write your program in Lisp, but don't complain when you discover how few developers out there are capable of maintaining such an application.

Is English, with its hundreds of rules and exceptions, the best spoken language to communicate in? Of course not. But it's ubiquitous, and that's all that matters.


What a lovely comment.

Though I haven't met him in real life, I'm quite familiar with jrockway's work and he's hardly an "architecture astronaut" or in academia. He's a good programmer who gets real world work done. And guess what? I find his code well-written and easy to maintain. Go figure ...

Just because you don't need the items on his list, don't going throwing stones at those of us who do. You'd be like the people who rush out competitors to Microsoft Word on the theory that people only use 10% of the features -- only to discover everyone's using a different 10%.


I would add: A debugger that works, and an IDE that helps you get the job done (versus endless cycles of "print" debugging).

I'd rather use a moderately crappy language in a decent development environment than a wonderful language that was lacking tools support. It's not all about the language.


PHP is horrible but not because it lacks continuations or macros or partial evaluation.

PHP is horrible because it is like an higher level of C, with an horrible standard library where the same thing can be done in 5 different ways, without literals for the most basic data types like arrays, without the simplest meta-programming abilities (assuming you don't want to use eval of course), OOP in theory (with an horrible OOP system for a dynamic language) but with all the base types that are not, and so on.


"without literals for the most basic data types like arrays"

You know, I assumed that would bother me a lot more than it actually does.


Oh, Python is rather flexible. You can program in several styles - including something that smells like Functional Programming.

It's only on a tactical level that you see "There is one way to do it" in action.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: