Re: Code References
| From: | Sterling Hughes | Date: | Mon, 19 May 2003 13:34:36 +0000 |
| Subject: | Re: Code References | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-1707@lists.php.net to get a copy of this message | ||
On Mon, 2003-05-19 at 10:55, Wez Furlong wrote:
> use perl;
Python, Ruby, LISP, Java, C, whatever, all support this in some form or
another (whether it be function pointers or code references.)
>
> This isn't exactly readable...
>
Its more readable to me. At least the concept of code references is.
When you want to have a lot of callbacks with relatively low overhead,
code references are the way to go (we could also have sort and friends
cache the initial lookup, instead of call_user_func() on the function
name over and over and over and over again, but code references are
cleaner imho).
As for anonymous functions, well, compared to create_function(), it is
faster, neater, and allows for more possibilities.
-Sterling
--
Good judgement comes from experience, and experience comes from
bad judgement.
- Fred Brooks