14 comments

[ 3.0 ms ] story [ 47.2 ms ] thread
Is this a joke?

> Believe it or not, I basically created this website just so that I could rant about PHP at an appropriate place.

> X-Powered-By:PHP/5.4.30

If he wasn't using PHP people would complain that people who don't know PHP shouldn't critique it.

Generally someone who uses the language in question is best equipped to critique it.

Not that I don't agree, but for arguments sake... and what are people to say, if he were using PHP? If he so clearly makes the case that he thinks PHP sucks, shouldn't he have the wisdom to use something else?
These questions are entirely orthogonal:

Does a thing suck?

Should i use a thing?

The answer to both of them can be yes at the same time, while being entirely true. Yes, i know, grokking this requires a little mental nimbleness (seriously though, only a little), but is an unavoidable truth stemming from the inherent complexity of the universe and the interactions of everything in it. There is no black and white. There is only a vast morass of grey in a variety of dimensions whose numbers vastly outstrip what the human mind normally has to deal with.

And one of the points in that morass is where all programming languages sit: They suck, and given the right conditions they should be used.

And frankly, if you REALLY want to find out what sucks about a programming language, the best person to ask is someone who both has a deep love for the language which has given him the experience; and the integrity to be honest to himself, and the world, about what ailments that language really has.

Perhaps they would.

We don't always have a choice in what language we use. Sometimes we do. In this case, he did. And he chose PHP. Not that it's here nor there, just seems ironic!

I read the first paragraph, stopped and wondered if he was using php for the site and there it is. I need not to investigate any further. Thx.
Oh great, one of these. This thread should be highly productive.

It's not a terrific sign that the first set of complaints are about the syntax of PHP/FI, which was retired sixteen years ago. (Source: http://php.net/manual/en/history.php.php) If you're going to write an article about how PHP sucks, you should probably constrain yourself to how it sucks in this century.

He's simply demonstrating how it started off poorly many years ago.

The writer puts his comments in the appropriate context by stating,

"Obviously, PHP started as a procedural language…or did it? Actually, it started as some weird html-meta-language, called PHP/FI that looked something like this..."

"Well then make your own then. Write a compiler and design some protocols, let's see how close your is to perfect."
"I have never deployed PHP on a production server by myself,"

As much as i dislike PHP, i can't take this rant seriously after reading a line like that.

If, like me, you had some trouble wrapping your head around how the conditional operator ?: was being parsed, it may be more apparent while looking at the equivalent Scheme:

  > (define initial 'J)
  > (define name (if (if (if (if (eq? initial 'M)
                               'Mike
                               (eq? initial 'J))
                           'John
                           (eq? initial 'C))
                       'Catherine
                       (eq? initial 'T))
                     'Thomas
                     'unknown))
  > name
  Thomas
Notice that the "then" clause and the "else" clause have two different types for all but the outermost if. The "then" clause is a symbol, while the "else" clause is a boolean. Furthermore, if the "then" clause is taken, the resulting symbol is considered truthy by the if operator. So, the innermost if expression evaluates to true, then, moving outward, we get 'John (which is truthy), then we get 'Catherine (which is also truthy), then finally we get 'Thomas, which is bound to name.

PHP's truthiness rules are different from Scheme's (and are far more complicated), but for this particular expression, the net result is the same.

For comparison, every other language with a ?: operator behaves like this:

  > (define nom (if (eq? initial 'M)
                  'Mike
                  (if (eq? initial 'J)
                    'John
                    (if (eq? initial 'C)
                      'Catherine
                        (if (eq? initial 'T)
                          'Thomas
                          'unknown)))))
  > nom
  John
Which is far more useful.