6 ms·
I wish I had more points to give this comment
by jcapote 17y ago
I wish I had more points to give this comment
- ars 17y agoWhy? PHP is not any worse or better than any other language. You can have bad programmers in any language - PHP just has lots of them because it's a popular language, but there is nothing wrong with the language itself.
- SwellJoe 17y agoI would argue that effectively having roughly 3,000 keywords is a problem of the language itself. And, saying, "PHP is not any worse or better than any other language" is saying that all languages are equal. Which, having worked in a number of languages over the years, including PHP, I know to be false. PHP is worse than many languages, and better than many for some classes of problem. It's just silly to say that all languages are equal.
- ars 17y agoPHP does not have 3000 keywords. It has an ordinary number, and the rest are functions - basically the standard library. You are confusing the language and the library. And for that matter the library is not bad either, it does however have a few poorly named legacy functions. > It's just silly to say that all languages are equal. Sorry, I wasn't really trying to say that. I meant "loosely typed procedural languages" not "any other language". You pick the language the matches what you are doing, there is nothing inherent about PHP that makes it bad.
- SwellJoe 17y agoPHP does not have 3000 keywords. It has an ordinary number, and the rest are functions - basically the standard library. A library function that is not optional is effectively a keyword. The PHP standard library (all ~3000 functions) is not optional, as far as I know.
- nir 17y agoMany (most?) of them are optional, you can compile PHP with/without certain extensions. Design wise, it seems insane - kind of like the iPhone's non-removable battery. Turns out it doesn't hurt either one's popularity though...
- SwellJoe 17y agoOK, so I really didn't think I needed to specify "at run-time" with regard to the meaning of "optional".
- ars 17y agoThey can be done at runtime, you can dl() whatever modules you want. However no one bothers. Why? Because while having lots of keywords is a problem in theory, in the real world it doesn't matter at all.
- noodle 17y agoi think the point that was trying to be made is that PHP has its uses. use it where it best fits to solve the problem. just like any other language.
- jon_dahl 17y agoI take it your test of language quality is Turing completeness?
- ars 17y agoAnd what would you like to change in PHP? Right now - what would you change. Keep in mind it's a loosely typed procedural language - that's not going to change. Given that, what would you change?
- jey 17y ago"Why? PHP is not any worse or better than any other language." False. Not all languages are created equal, and PHP is on the shittier end of the spectrum.
- ars 17y agoReally? So back up the statement - tell me exactly what's bad about PHP. And as I said before, it's a loosely typed procedural language, so don't try to compare it to a functional one. Within that type of language, what's bad about PHP?
- encoderer 17y agoI like PHP just fine and use it often. But if you really want an answer to that question, I'll give you one: inconsistency. Not saying I don't understand it, and I'm not saying I blame the way PHP has evolved. But it does have a lot of inconsistency.
- holygoat 17y agoAre you aware that your challenge is rapidly approaching "without reference to anything better, tell me about PHP's failings"? The usual technique for evaluating something is to compare it to its competitors, and some of those are functional! One of the bad things about PHP is that it lacks the higher-order capabilities of most functional languages. It's also inconsistent, easy to write slow code in, makes it easy to introduce massive vulnerabilities, and ugly. It's 2009. Nobody should be using PHP any more.
- ars 17y agoPHP is not a functional language. People like functional languages in theory, for the style. But not so much when it comes to actually using them. And what's ugly about PHP? It looks almost exactly like C. It is inconsistent (sometimes), but it's not "easy to write slow code in", there is nothing in PHP that makes slow code more or less likely. It's 2009. Everyone IS using PHP, and almost no one uses functional languages. Oh they get a lot of press, but few deployments. I'm really tired of these illogical attacks on PHP. No one has ever told me a problem in PHP compared to other procedural languages except that 0 == "" is confusing. It's always "but everyone knows it's bad". Sure go along with peer pressure if you like, but I prefer to look at reality.
- jrockway 17y agoPHP is missing many features that good programmers need to write good code. Anonymous functions, lexical environments, the list goes on. You can write OK code with PHP, but you can't write excellent code. (And no, I am not implying that code is bad unless you use a lot of anonymous functions. I am just saying that it's an essential tool that you really need when certain situations arise. In PHP, those situations will have to involve hacks.)
- ars 17y agoPHP has anonymous functions, so I guess now you love PHP. You say the "list goes on" - so I googled for a list http://www.tnx.nl/php.html http://www.tnx.nl/php.html. And half the things on the list aren't even true! And the rest are style choices (more functions with less parameters, or fewer functions with more parameters).
- jrockway 17y agoHere is a list: continuations, closures (which is what I really meant by anonymous functions and lexical environments, but I guess the term "environment" is not familiar to people that don't program CL), macros, real OO (classes/traits, first-class attributes, a metaobject protocol, etc), a sane type (constraint) system, and so on. Nobody cares about the order of arguments to a function in the standard library, that's trivial to ignore and fix. What PHP is missing is a way to extend the language, which means you are stuck with whatever the designers give you (which sucks hard). Anyway, if you haven't used these features before, you might not see the need; see the "Blub" essay for details on that.
- weavejester 17y ago> PHP is not any worse or better than any other language. I disagree. Consider the following PHP: function inc_all($i, $xs) { array_map($xs, function($x) use ($i) { return $x + $i; }); } And compare it to the equivalent in, for instance, Haskell: inc_all i = map (+ i) Most languages can express the same concepts as PHP, but can do so much more clearly and concisely. The criticism of PHP is deserved: it's a very badly designed language.
- ars 17y agoHaskell is a functional language, PHP is not. So it's not a valid comparison. Every time I ask people what's wrong with PHP they give me answers from functional languages. I've yet to see anyone give me an example from a procedural language.
- psygnisfive 17y agoYou're right. Let's compare to a more adequate language. Like Ruby. def inc_all(i, xs) xs.map { |x| x + i } end
- jamesbritt 17y ago"PHP is not any worse or better than any other language." Haskell fits as "any other". "Haskell is a functional language, PHP is not. So it's not a valid comparison." So, PHP is not any worse or better than any other language that's just like PHP?
- lhorie 17y ago> PHP is not any worse or better than any other language. I also disagree, but in the sense that PHP is both better and worse than other languages, depending on your metrics. I feel that talking about code terseness is weird if it takes more effort to actually complete whatever project you're working on (due to lack of libraries, less active community, what have you).
- joshu 17y agoI'm pretty sure it's actually worse.