| From | Sent On | Attachments |
|---|---|---|
| Hannes Magnusson | Jun 6, 2011 12:41 pm | .txt |
| Stas Malyshev | Jun 6, 2011 1:35 pm | |
| Hannes Magnusson | Jun 6, 2011 1:48 pm | |
| Christopher Jones | Jun 6, 2011 1:49 pm | |
| Stas Malyshev | Jun 6, 2011 2:16 pm | |
| Matthew Weier O'Phinney | Jun 6, 2011 3:15 pm | |
| Pierre Joye | Jun 6, 2011 3:26 pm | |
| Matthew Weier O'Phinney | Jun 6, 2011 3:32 pm | |
| Etienne Kneuss | Jun 6, 2011 3:41 pm | |
| Chris Stockton | Jun 6, 2011 3:51 pm | |
| Chris Stockton | Jun 6, 2011 3:52 pm | |
| Ferenc Kovacs | Jun 6, 2011 4:01 pm | |
| Stas Malyshev | Jun 6, 2011 4:01 pm | |
| Chris Stockton | Jun 6, 2011 4:20 pm | |
| Derick Rethans | Jun 6, 2011 4:30 pm | |
| Martin Scotta | Jun 6, 2011 7:50 pm | |
| Jordi Boggiano | Jun 7, 2011 3:08 am | |
| Hannes Magnusson | Jun 7, 2011 6:59 am | |
| Richard Quadling | Jun 7, 2011 7:03 am | |
| Hannes Magnusson | Jun 7, 2011 7:21 am | |
| Jaroslav Hanslik | Jun 7, 2011 8:22 am | |
| Matthew Weier O'Phinney | Jun 7, 2011 9:10 am | |
| Stas Malyshev | Jun 7, 2011 11:50 am | |
| David Zülke | Jun 7, 2011 12:03 pm | |
| Stas Malyshev | Jun 7, 2011 12:12 pm | |
| David Zülke | Jun 7, 2011 12:28 pm | |
| Anthony Ferrara | Jun 7, 2011 12:37 pm | |
| Martin Scotta | Jun 7, 2011 1:28 pm | |
| Stas Malyshev | Jun 7, 2011 1:31 pm | |
| David Zülke | Jun 7, 2011 1:32 pm | |
| Pierre Joye | Jun 7, 2011 1:36 pm | |
| Mike van Riel | Jun 7, 2011 1:43 pm | |
| Matthew Weier O'Phinney | Jun 7, 2011 1:44 pm | |
| dukeofgaming | Jun 7, 2011 2:15 pm | |
| Matthew Weier O'Phinney | Jun 7, 2011 2:41 pm | |
| dukeofgaming | Jun 7, 2011 3:38 pm | |
| Johannes Schlüter | Jun 7, 2011 4:39 pm | |
| David Zülke | Jun 7, 2011 5:04 pm | |
| Alexey Shein | Jun 7, 2011 10:24 pm | |
| Hannes Magnusson | Jun 8, 2011 1:31 am | |
| Hannes Magnusson | Jun 8, 2011 1:38 am | |
| Alexey Shein | Jun 8, 2011 1:47 am | |
| Johannes Schlüter | Jun 8, 2011 3:04 am | |
| Hannes Magnusson | Jun 8, 2011 3:17 am | |
| Richard Quadling | Jun 8, 2011 3:27 am | |
| Johannes Schlüter | Jun 8, 2011 3:28 am | |
| Hannes Magnusson | Jun 8, 2011 3:30 am | |
| Johannes Schlüter | Jun 8, 2011 3:31 am | |
| Richard Quadling | Jun 8, 2011 3:31 am | |
| Anthony Ferrara | Jun 8, 2011 6:31 am | |
| Martin Scotta | Jun 8, 2011 7:42 am | |
| Martin Scotta | Jun 8, 2011 7:48 am | |
| David Zülke | Jun 8, 2011 8:53 am | |
| Johannes Schlüter | Jul 10, 2011 12:02 pm | |
| Stas Malyshev | Jul 10, 2011 12:57 pm | |
| Hannes Magnusson | Jul 11, 2011 1:21 am | |
| Stas Malyshev | Jul 11, 2011 1:27 am | |
| Peter Cowburn | Jul 11, 2011 1:37 am | |
| Hannes Magnusson | Jul 11, 2011 1:38 am | |
| Stas Malyshev | Jul 11, 2011 1:43 am |
| Subject: | Re: [PHP-DEV] Callable type | |
|---|---|---|
| From: | Anthony Ferrara (ircm...@gmail.com) | |
| Date: | Jun 7, 2011 12:37:12 pm | |
| List: | net.php.lists.internals | |
For me personally it makes zero sense that having just removed strict typing we are introducing it back through back door, but if everybody likes it so be it.
It's strict typing to have a type-hint that can be matched by 4 different constructs (string function names, arrays, closures, invokable classes)? Basically anything that would succeed in call_user_func would be allowed to pass...? There's no "dynamic typing" that I'm aware of that this would prevent. Either it's callable, or it's not. No casting or silent type conversion is going to change that.
So it's not making typing stricter at all. All it does is allow you to say "I want this parameter to be able to be directly called". *What* form of call you give it doesn't matter one bit. So in a sense, it's like having a String type-hint that casts if it can, but throws an error if it can't (Ex: an object without __toString). This will allow if there's a way to call it, and throw an error if not.
I'm all for this addition. +1
On Tue, Jun 7, 2011 at 3:12 PM, Stas Malyshev <smal...@sugarcrm.com> wrote:
Hi!
It is good there's an RFC. However it seems to lack code examples. I understand it may be obvious to the proposers how it looks like, but it'd be nice to have the actual example there as it is done nearly everywhere else.
The patch introduces new zval type IS_CALLABLE but zval functions weren't updated for it - IIRC at least dtor may end up being called on IS_CALLABLE value produced in the parser.
Note also that this pseudo-type is called "callback" in all of our documentation, which means we have now documentation that says:
bool array_walk ( array &$array , callback $funcname [, mixed $userdata ] )
and type check that says "callable".
Also, it is not clear what would happen if this type check is made against method which is not accessible (e.g. private out of scope). Would it say that the argument is invalid (which would be really confusing since it'd say something like "callable expected, array given" which it technically correct but doesn't explain why this array is not callable) or would allow it? If not, then zend_is_callable error information should be used and displayed. And the tests need to cover these cases, along with __call and __callStatic.
For me personally it makes zero sense that having just removed strict typing we are introducing it back through back door, but if everybody likes it so be it.
-- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227
-- 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






.txt