3 ms·
I'm not going to waste time bashing PHP, that's a dead horse. I'm just going to say that's it's a bit amusing that of the things he lists as "revelations" pyth
by TylerE 14y ago
I'm not going to waste time bashing PHP, that's a dead horse.
I'm just going to say that's it's a bit amusing that of the things he lists as "revelations" python has had since:
1. when dinosaurs roamed the earth (lambda)
2. 2003 (wsgi)
3. years ago (pip/easy_install)
4. ages (db-api)
- rll 14y agolambda was added to PHP in June 2000
- TylerE 14y agoand in Python 1.0 in 1994. Also, I can find no reference to PHP having anonymous functions/lambdas prior to 5.3, which is the version number given in both the linked article and PHP docs.
- rll 14y agoThere is a difference between a closure and a lambda. PHP's create_function() implemented lambdas in PHP version 4.0.1 which was released in June 2000. 5.3 added closures.
- TylerE 14y agocreate_function is not equivalent to a python lambda. It's just a function for creating other functions. The key thing with a lambda in python is that it is defined at the usage site. so you can do: filter(lambda x: x > 42, mylist) Whereas in php that would be: $mylambda = create_function('$x','return $x > 42;'); filter($mylambda, $mylist); Yes, the usage strings as code adds yet another level of WTF to this example.
- rll 14y agoIt is still an anonymous function.
- papsosouid 14y agoYou said "lambda was added to PHP in June 2000". That is clearly not the case, and now you are trying to play semantic games to pretend you are still right. The function create_function() is not lambdas. It isn't even anonymous functions, they are still named, you just don't know the name. You can easily get a duplicate function error from using create_function(), which means it is most certainly not anonymous. Note that php.net/create_function even points you to their page on actual anonymous functions, which they erroneously claim are the same as closures.
- lucperkins 14y agoMy point wasn't that these things don't exist in other languages. Again, I'm not saying that PHP is objectively better than anything else. I know not to play that game. All that I'm doing is remaining steadfast in my claim that PHP doesn't deserve all the flak that it gets and that the language deserves consideration for a whole variety of use cases. That's all!
- papsosouid 14y agoBut if it isn't objectively better than similar languages in any way, then why does it deserve consideration? "You can work around and/or avoid most of the horrible problems in PHP" isn't a compelling argument in favour of PHP when every other language just doesn't have those horrible problems to begin with.
- TylerE 14y agoExactly. More cogently: If PHP is where python was in 2007, why wouldn't I want to use the python of 2012?
- malachismith 14y agoIn that case, shouldn't we all be using C?
- papsosouid 14y agoI can't think of any logical way to put your post in context. Why would we all be using C?