rfc:callable
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
rfc:callable [2011/06/16 00:08] – [Previous discussions] stas | rfc:callable [2013/10/29 17:28] – -> Implemented nikic | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2011-06-07 | * Date: 2011-06-07 | ||
* Author: Hannes Magnusson < | * Author: Hannes Magnusson < | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
Line 19: | Line 19: | ||
The typehint would allow a string with a function name, an array composed of classname/ | The typehint would allow a string with a function name, an array composed of classname/ | ||
+ | |||
+ | ===== Callable vs Callback ===== | ||
+ | |||
+ | callback is callable, the opposite could not be true. A string, or a closure, is callable, but the string is not a callback. | ||
+ | |||
+ | The documentations already use `array` hinting when a function expects an array, even though it does not type hint on it. | ||
+ | The documentations already use `callable` hiting when a function expects a callable instance, even though it does not type hint on it. | ||
+ | |||
+ | Furthermore we already have a function called is_callable(), | ||
+ | |||
+ | Introducing a different name (i..e callback) will therefore only create more inconsistencies and confusion. | ||
+ | |||
+ | The callable typehint reuses the is_callable() logic. | ||
+ | |||
+ | ===== Initialization ===== | ||
+ | |||
+ | Only null initialize is allowed, making it consistent with classname typehinting. | ||
+ | |||
Line 39: | Line 57: | ||
* As for the patch itself, Felipe pointed out that the patch is missing an method in ext/ | * As for the patch itself, Felipe pointed out that the patch is missing an method in ext/ | ||
* Things to finalize: | * Things to finalize: | ||
- | * Type name: documentation uses ' | ||
- | * Are initializers allowed? | ||
* Reflection support | * Reflection support | ||
* Arginfo support | * Arginfo support | ||
Line 48: | Line 64: | ||
* June 7th 2011, Initial writeup | * June 7th 2011, Initial writeup | ||
+ | * July 27th 2011, Added " | ||
+ | |||
rfc/callable.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1