Hi,
Alexey Borzov wrote:
>
> Hi,
>
> Lukas Feiler wrote:
> > A couple of days ago I proposed the package
PEAR_Callback;
> > see http://pear.php.net/pepr/pepr-proposal-show.php?id=468
> >
> > It addresses three major limitations of the
callback pseudo-type:
> > - By looking at a callback pseudo-type variable
you
> > cannot tell if it really is a callback.
> > - The callback pseudo-type does not allow you to
specify
> > arguments at the time you create the callback.
> > - There is no way to force a user to pass only
callback
> > functions to your API, that meet certain
requirements
> > (i.e. accept certain arguments and have a
certain
> > return type)
>
> All of these major limitations can be overcome by using
the
> Command design pattern:
> http://e
n.wikipedia.org/wiki/Command_pattern
>
> I don't honestly see the benefit for PEAR in adding a
wrapper
> around functions
> when all these checks are already available for classes
/
> objects in PHP5.
>
PEAR_Callback effectively is a general command pattern
implementation - it
eliminates the need to write a command class for every
callback function a
programmer wants to use.
But I do get your point. After all, OO languages like Java
don't even have
something like call_user_func().
Cheers,
Lukas
--
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php
|