Re: Re: PHP 6.0 Wishlist

From: Date: Mon, 22 Aug 2005 19:53:02 +0000
Subject: Re: Re: PHP 6.0 Wishlist
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-18272@lists.php.net to get a copy of this message
On Aug 22, 2005, at 2:08 PM, Stanislav Malyshev wrote:
MB>>> * Anonymous functions. The real stuff, not just some odd string MB>>> passed to create_function(). MB>> MB>>There were some others already asking for this, maybe we should at least MB>>give it a thought if it is doable at all, anybody? Just out of curiosity, what's bad in create_function and how "real" ones should be different?
Two major differences as I see it: 1) syntactical: the amount of escaping/funkyjunk you need to do to have anonymous functions look like regular functions in their declaration is huge (yes, you can use heredocs, but they have their (big if you run up against them) limitations as well). 2) no garbage collection on them (so in something like perl, when you anonymous sub goes out of scope, it's cleaned up). 3) runtime vs. compiletime definition For me 3 is good the way it is (the whole point of anon. functions (for me) is to allow me to easily vary their definition at runtime). 2 I can see being a pain, but I don't consider it critical. 1 keeps me from using create_function - the required code is to obtuse to use in most cases - I really would like to be able to do: $max = function ($a, $b) { return $a < $b?$b:$a; } (for why heredocs suck here, consider the case where I want to use constants in the definition). George
--Stanislav Malyshev, Zend Products Engineer stas@zend.com http://www.zend.com/ +972-3-6139665 ext.115 --PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
George Schlossnagle -- Vice President of Engineering -- OmniTI Computer Consulting -- http://www.omniti.com

« previous php.internals (#18272) next »