4 ms·
> It might be better than Perl, but not by much. Oh come on. PHP is more evolutionarily fit than Perl in a handful of very important ways (I would illuminate,
by brennen 13y ago
> It might be better than Perl, but not by much.
Oh come on.
PHP is more evolutionarily fit than Perl in a handful of very important ways (I would illuminate, for example, function signatures and a pre-built object system, syntactically trivial nesting of data structures, and a newcomer-friendly out-of-the-box execution model).
That said, I wrote Perl for years as a hobbyist (still do, now and then), and have spent the last 6 or so primarily writing PHP. There is not a day that passes that I don't miss some aspect of the rich, expressive, elegant, sophisticated, and intellectually delightful environment that is Perl at its best.
It is a doomed and sinking continent, Perl, but if we let the considerable wisdom of its once-great civilization evaporate into trite dismissal, we as a culture stand to lose a great deal.
- kbenson 13y agosyntactically trivial nesting of data structures I always found PHP's insistence on the array() keyword annoying, and the mixing of associative and sequential arrays ambiguous. Perl's data structures (in their simplest form) and JSON are very similar, and I think JSON is a fine format. You're mostly right on the other points though. Although I do love Perl's use of signatures in some cases.
- MindTwister 13y agoThat was actually fixed in 5.4: http://www.php.net/manual/en/language.types.array.php http://www.php.net/manual/en/language.types.array.php You can now write $numbers = [1,2,3]; Or even $numbers = ['first' => 1, 'second', => 2, 'third' => 3]; I'd think the mixing of associative and sequential arrays are one of the key things that lowers the barrier to entry though.
- kbenson 13y agoI had heard they were finally fixing that, which is why I made my comment a reference to the past. I'm glad they settled on a syntax that wasn't too far out of the norm from what you would expect, given PHP's roots (i.e. Perl). I seem to recall the RFC at some point had a different syntax, but I could be remembering incorrectly. I'd think the mixing of associative and sequential arrays are one of the key things that lowers the barrier to entry though. For me it fails the "similar things should look similar, different things should look different" test. Then again, they aren't really all that different in PHP. I guess it comes down to me preferring my sequential and associative data structures to be separate, which is a fairly fundamental difference to how PHP thinks it should be. I have a sneaking suspicion that the complexity this data structure tries to hide leaks out through the numerous functions used to interact with it[1], which just shifts the pain slightly farther down the line, and possibly from a one-time event (when learning the fundamentals) to a regular occurrence as it causes problems continually later. 1: http://c2.com/cgi/wiki?WaterbedTheory http://c2.com/cgi/wiki?WaterbedTheory
- benwerd 13y agoPHP doesn't insist on the array() keyword, currently. The mixing of associative and sequential arrays is ambiguous, although you can think of them all as being associative; it's just, PHP will supply some keys if you don't provide any. Whether that's kludgey or acceptable is up for discussion. (I don't mind it at all.)
- kbenson 13y agoIt's not so much that I think it's kludgy, as much as I think it may be a harmful abstraction, as faintly outlined in my sibling comment.