rfc:callable
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
rfc:callable [2011/06/07 18:53] – fix title bjori | rfc:callable [2011/07/27 09:04] – initialization and name bjori | ||
---|---|---|---|
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 34: | Line 52: | ||
* The only arguments against the idea came from Stas, [[http:// | * The only arguments against the idea came from Stas, [[http:// | ||
- | * ' | + | * ' |
- | * A " | + | * A " |
* Everyone else seem to like the idea, so far. | * Everyone else seem to like the idea, so far. | ||
* 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: | ||
+ | * Reflection support | ||
+ | * Arginfo support | ||
rfc/callable.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1