2) The patch should define something like ZEND_ARG_TYPE_INFO()
Yeah, that can be used or existing macros can be retained using "type"
parameter, which can even made BC compliant by using new sets of
constants that match the IS_ARRAY or "not hint" semantics.
3) do we really need IS_CLASS constant?
Only because there is a class hint (currently supported) function foo
(StdClass $foo) {} and there was a request to support a generic object
hint. So one became IS_CLASS and one is IS_OBJECT.
4) arg_info->array_type_hint should be probably changed into
arg_info->type_hint. May be it's better to use bitset mask for it.
Then we won't need IS_SCALAR and IS_NUMERIC as well and arg_info-
>allow_null field.
Originally that is how I had it, but to avoid BC break I've renamed
the property back to type_hint.
Otherwise the patch looks good, but note that for now it only
slowdowns execution a bit because of addition checks. I hope, it'll
be possible to use these hints in the future to generate more
optimal code.
+1 for php6 after improvements
Thanks. Dmitry.
Ilia Alshanetsky wrote:
Last week or so there was a fairly detailed discussion on the
internals list regarding type hinting based on my original patch.
Since then the patch has been revised to address the major concerns
that were identified (breakage of binary compatibility) as well
extended with additional functionality (object hint, type casting,
reflection support, etc...).
The final patch is available here: http://ilia.ws/patch/type_hint_53_v2.txt
The test suit is available here: http://ia.gd/patch/type_hint_tests.tar.bz2
I would like to ask all developers to voice their opinions of
whether it makes sense to add this to 5.3 or to throw it away
(either one is fine btw). To keep the process simple & flamewar
free, please restrict yourself to +/- (1/0), next week monday I'll
run a tally of the votes and based on the result we can determine
how to proceed further.
Ilia
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php