Guys,
Anonymous functions are really a niche feature and tend to lead to
pretty magical code. I really don't think that it's an important
enough feature which would be usable to the mainstream PHP users.
We really need to get a grip on the new features and not
overcomplicate the language. There will always be a thousand and 1
niche features we can borrow from other languages but the big
advantage and reason for PHP's success is its simplicity.
I think that if you're one of those power users that requires this
niche features then you can survive with create_function() or in
cases of other features, with other ways of achieving the same goal...
Andi
P.S.- I learn ML at university which is almost 100% closures. Very
ugly stuff... Unmaintainable and hard to parse in your brain.
At 08:47 AM 8/23/2005, Dmitry Stogov wrote:
> -----Original Message-----
> From: Michael Walter [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, August 23, 2005 10:18 AM
> To: Stanislav Malyshev
> Cc: Marcus Boerger; internals@lists.php.net
> Subject: Re: [PHP-DEV] Re: PHP 6.0 Wishlist
>
>
> On 8/22/05, Stanislav Malyshev <[EMAIL PROTECTED]> 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
> > MB>>least 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?
>
> "Real" anonymous functions (as in, closures) should be able
> to capture variables from its lexical environment, e.g.:
>
> function adder($a) {return function($b) {return $a+$b;}}
> function index($i) {return function($a) {return $a[$i];}}
>
> I'm sure you can think of useful examples.
I like this syntax and expected behavior.
The only problem is implementation.
Anonymous functions those don't capture variables from lexical scope can be
compiled once at file compile time, instead of evaluating in
create_function(). But I don't see how it can be done with variable
capturing.
Thanks. Dmitry.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php