Re: Callable type

From: Date: Wed, 08 Jun 2011 08:31:38 +0000
Subject: Re: Callable type
References: 1 2 3 4 5 6 7 8 9 10 11 12  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
We have the situation in the docs that parameters declared as arrays
do not follow the typehinting rules, but parameters as class names do.
Re-using the callback from the docs could get confusing when
extensions start to typehint on it, but not the core..

I think there is a subtle difference between a callback, and a callable.
In javascript for example, callback is something that is executed on
certain events "onsuccess" is the typical example.
There is nothing that says the callable parameter gets executed as a
part of an event, and I think the default usecase would be to execute
it right away (f.e. filtering data).

I think I would prefer callable, but I could live with either.

-Hannes




On Tue, Jun 7, 2011 at 23:41, Matthew Weier O'Phinney
<[email protected]> wrote:
> On 2011-06-07, dukeofgaming <[email protected]> wrote:
>> --0016e68ee3e4bc4b0e04a525bac6
>> Content-Type: text/plain; charset=ISO-8859-1
>> Content-Transfer-Encoding: quoted-printable
>>
>> +1 for "callable", it is really more consistent.
>
> I was actually agreeing With David and Stas that "callback" was more
> consistent, and casting my vote for that.
>
>> On Tue, Jun 7, 2011 at 3:44 PM, Matthew Weier O'Phinney <
>> [email protected]> wrote:
>>
>> > On 2011-06-07, David Z=FClke <[email protected]> wrote:
>> > > On 07.06.2011, at 22:31, Stas Malyshev wrote:
>> > > > > callback is callable, the opposite could not be true.  a string
>> > > > > --or a closure-- is callable, but the string is not a callback
>> > > >
>> > > According to our docs, which were out there for years, it is. One of
>> > > the main and widespread complaints about PHP is the lack of any system
>> > > in naming, design and documentation, it is sad to see how many people
>> > > want to make it worse instead of making it better
>> > >
>> > > +1. I'm thinking it should be "callback", or the docs should be
>> > > adjusted. "callable" arguably does make more sense, but either way, it
>> > > needs to be consistent, that's what matters most.
>> >
>> > Agreed, here. "callback" is the usage throughout the documentation to
>> > refer to anything that passes is_callable().
>
> --
> Matthew Weier O'Phinney
> Project Lead            | [email protected]
> Zend Framework          | http://framework.zend.com/
> PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Thread (63 messages)

« previous php.internals (#53195) next »