6 ms·
How would they fix it anyway? It was never really designed, it just evolved as a slow accretion of features using whatever syntax was convenient in the parser
by dasil003 13y ago
How would they fix it anyway? It was never really designed, it just evolved as a slow accretion of features using whatever syntax was convenient in the parser codebase over a couple of decades.
The author makes a good point that people like me who ditched PHP in the mid-2000s should probably stop complaining about it since we don't really know the current state of affairs.
The problem is when we have languages like Ruby, Clojure, Scala, Haskell, or even plain old Javascript ala Node, why would I waste another thought on PHP? PHP was created to make very simple dynamic web pages, and I would still use it for that in the way that I still write bash scripts for simple shell operations to avoid a higher level dependency like Ruby or Perl. I'll use PHP for small stuff, but I see no benefit towards putting any real engineering effort into a PHP project.
- philipp-de 13y agoJavascript, of all things, wasn't neatly "designed" either. The core language was hacked together in several weeks, by a few developer at Netscape. Javascript wasn't made for large applications. It was made for form checking and rollover menues (some of the earliest examples back in the day) ;) It can be argued that Javascript has many unfixable design bugs, too. Just sayin.
- dasil003 13y agoWell that's why I said "even" Javascript. Brendan Eich actually pulled off a small miracle by embedding incredibly powerful functional and prototypal paradigms in JS. It's not perfect, and there are plenty of warts, but JS came out of the gate with a powerful core that PHP took decades to add in a Frankenstein manner.
- PommeDeTerre 13y agoEnough with the "JavaScript is a functional language" myth, please. Merely having first-class functions does not make a language a functional programming language. JavaScript does not promote the use of pure functions, referential transparency, and the minimization of state. JavaScript does not encourage the use of recursion. JavaScript has an atrociously broken type system, rather than a robust and theoretically sound one. JavaScript does not offer pattern matching and other functionality offered by modern functional languages. In fact, JavaScript goes out of its way to promote a very imperative, non-functional style of software development, even when efforts are made to try to use it in a functional way. And JavaScript's prototype-based OO is anything but powerful. In practice, it's nearly useless. That's why we see so many JavaScript developers try to fake a class-like OO system using it, since class-based OO does offer what they need and want. But due to the incapability of JavaScript's prototype-based approach, these hacks end up being incompatible maintenance headaches. JavaScript does not have a "powerful core". It has a rotten core, just like PHP, and it has evolved in a broken manner, just like PHP.
- MichaelGG 13y agoWhat is the nature of functional programming? HoF.
- PommeDeTerre 13y agoSupport for higher-order functions is obviously a minimal requirement of a "functional programming language". But functional programming extends far, far beyond that. It also embodies a philosophy emphasizing the purity of such functions. It encourages the use of recursion for iteration. It encourages the use of robust type systems. It encourages the use of pattern matching. It discourages the use of many imperative approaches. Although they may offer some form of higher-order functions these days, I don't consider languages like JavaScript, C#, C++, Ruby or PHP to be "functional programming languages". They're imperative languages that just happen to have added the most basic of functionality expected from functional programming languages. They don't truly encourage, and only partially enable, the writing of software using a functional approach.
- Shorel 13y agoAccording to you, is Common Lisp functional?
- PommeDeTerre 13y agoI wouldn't say so. It's far, far closer to a functional programming language than JavaScript is, for instance. But it's clearly nowhere near what Haskell or Standard ML are, either. Maybe "semi-functional" would be a good term for it and Scheme. It has some of the important elements of functional programming, but not all of them.
- dasil003 13y agoDon't set me up as straw man for your anti-JS rant. I never said JavaScript was a functional language, and I never said it was a great language. I just said it is better conceived than PHP, no more, no less.
- 13y ago
- justincormack 13y agoYou would have to break it to fix it. Backwards compatibility kills you unless you never make bad decisions. Some languages manage this, eg Lua that has a (long slow) cycle of deprecate, remove on features.
- philipp-de 13y ago(can't reply to your reply so here goes) I'd argue that PHP came out of the gate with some pretty powerful properties, too. They hit a sweet spot of * Being there at the right time (none of the "good" languages in your book was around or usable for web dev at the time of PHP4 and PHP5 came out) * Being easy to learn - giving beginners quick rewards. * Being powerful enough to do quite a bit more than "simple web pages", as you say. This enabled people to "graduate" from "simple web pages" to "web apps". In fact, most of the web was built in PHP (Wikipedia, Facebook, Wordpress runs on 50% of all webpages or so, Drupal is incredibly popular, Magento runs loads of webshops, and on and on). This has not happened merely by accident. I feel it's a bit wrongheaded to suggest otherwise. * Being dead easy to deploy on almost any webhost (Drop files, hit them with their url, be done - almost no other language delivers this even today) In all i feel PHP has moved the web forward tremendously. In time, itself has evolved as well. It may not have evolved as fast as one would want. It's the C++ of the web era, really.
- boomlinde 13y ago"Being there at the right time" is pretty much the only redeeming quality it has, and it's not so much a quality of the language, is it? "Easy to learn" is not the same as giving beginners quick rewards. Being easy to learn, in reality, would probably result in things like Wordpress not having more holes than a swiss cheese. "Powerful enough" -- most web frameworks are. Saying that it didn't happen by accident of course depends on how you define accident. Personally I think the only thing PHP has got going for it is the timing and next point: "Dead easy to deploy" again isn't a property of the language. Saying that "almost no language delivers this" about something that's really up to the service you're using to host your website isn't fair, in that it actually has nothing to do with the language. I must say that I wholeheartedly agree with your closing statements, though.
- rybosome 13y ago"In all i feel PHP has moved the web forward tremendously." Agreed, wholeheartedly. I truly dislike PHP as a language, but one cannot deny the massive impact it had in making web applications commonplace.