Re: PATCH: anonymous functions in PHP
| From: | Richard Lynch | Date: | Mon, 19 Mar 2007 22:26:25 +0000 |
| Subject: | Re: PATCH: anonymous functions in PHP | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-28466@lists.php.net to get a copy of this message | ||
On Mon, March 19, 2007 4:55 pm, Stanislav Malyshev wrote:
>> You have to have a pretty esoteric function to need that kind of
>> scope
>> control, no?
>
> Depends on your background. Some people consider LISP intuitive
> language
> :) And if you work with Javascript, you probably would be doing it
> daily
> - most AJAX toolkits rely on heavy usage of anonymous functions. Not
> sure it needs to be in PHP though. It might be cool thing, but it's
> definitely becomes very confusing very fast.
I almost finished my MS in CS with Artificial Intelligence
concentration at DePaul, so I *was* one of those CS students with too
much time on my hands.
Then I worked at an AI think tank lab at Northwestern University for
most of a decade using Lisp.
I gotta say that while it was Really Nifty to know all about those
esoteric closures, curries, and whatnot I have since forgot, mostly, I
didn't need these things on a daily basis even at that job.
So, yes, somebody somewhere "needs" this, but is it the kind of thing
that belongs in PHP?
I think not.
By "this" I mean the ability to have the lexical closure carry its
scope around with itself.
I *WANT* to have a simple clean anonymous function syntax.
Can't you just take the body of "create_function" with the syntax of
the patch, and marry those two?
How does the current create_function handle this same scope issue?
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?