4 ms·
While I personally think that closures and lexical scoping are desirable feature in any language, this seems a bit like putting lipstick on a pig to me. As a s
by rcoder 18y ago
While I personally think that closures and lexical scoping are desirable feature in any language, this seems a bit like putting lipstick on a pig to me.
As a simple wrapper around various C libraries with automatic memory management and higher-level syntax, PHP makes a certain kind of sense, warts and all. As a general-purpose high-level language, I have to wonder exactly what problem it solves that Perl, Ruby, and Python haven't already done better.
What do you think the average newbie PHP developer is going to do the first time they encounter a function which closes over a class instance as state, and then returns a lambda?
The subtle interplay between reference vs. value calling conventions, PHP's weird scoping rules, and the new 'lexical' keyword seems like a sure source of head-scratching for new developers, too.
- nir 18y ago"I have to wonder exactly what problem it solves that Perl, Ruby, and Python haven't already done better" I don't know what, but evidence (Wikipedia, Facebook, Yahoo, Digg, Wordpress, Drupal...) seem to say that there is something PHP is doing significantly better than all of these. "What do you think the average newbie PHP developer is going to do the first time they encounter a function which closes over a class instance as state, and then returns a lambda?" Perhaps they won't encounter this at all, but they might well be coding inside a framework - whether light MVC or something like Drupal - that makes use of this. For something to be useful it doesn't have to be useful for everyone who use the language.
- rcoder 18y ago> I don't know what, but evidence (Wikipedia, Facebook, Yahoo, Digg, Wordpress, Drupal...) seem to say that there is something PHP is doing significantly better than all of these. I think that PHP is doing precisely what I said it was good at: wrapping high-performance C libraries with a higher-level syntax for doing fast dynamic web content generation. It's not a good systems language, and features trying to make it more like one always feel a bit "bolted-on." > For something to be useful it doesn't have to be useful for everyone who use the language. Actually, changes to core language syntax aboslutely need to be considered in light of their relevance to the entire user community, not just the most experienced developers. Most programmers spend far more time reading code than writing it. If you increase the complexity of a language, (note: I mean semantic complexity here, not syntactic) you increase the difficulty involved in reading it. In my not-so-humble opinion, PHP works when aimed at the lower end of the semantic complexity scale. Trying to turn it into a general-purpose language for "programming in the large" seems a rather unfortunate use of energy, given (as you pointed out) its obvious success in its existing niche.
- henryw 18y agoi think this comment belongs to the category of: say anything about ruby = upvote. say anything about php = downvote
- rcoder 18y agoAbsolutely not. My point was very specific: namely, that PHP as a language has a reasonable level of complexity for the problems it is designed to solve. Much of the value of PHP as a language is due to this very simplicity.