Re: Re: [PHP-DEV] Type hinting
| From: | Kalle Sommer Nielsen | Date: | Thu, 29 Jul 2010 15:18:59 +0000 |
| Subject: | Re: Re: [PHP-DEV] Type hinting | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-49172@lists.php.net to get a copy of this message | ||
Hello Zeev
2010/7/29 Zeev Suraski <zeev@zend.com>:
> With the revived interest in the neighbourhood of type hints in the last few
> days I'm resending this email from a few weeks ago.
>
> In a nutshell, use auto-conversion for scalar type hints, and modify the
> conversion rules throughout PHP to handle 'senseless' conversions that
> result in data loss differently - by emitting E_TYPE.
>
> Zeev
Ill be very much against adding a new error level for typing, E_NOTICE
or E_WARNING should be *enough* for letting the user know of any data
loss. I don't think it would be a good idea for adding a new error
level for specific language features, if we went to use exceptions for
everything it would however have been a sleek solution but we don't.
As for which solution we should take, we need a userland vote and a
core vote foreach of the 3 solutions we have atm.:
* Strict typehinting (as whats currently in trunk)
* Weak typehinting (with silent autoconvertion)
* Weak typehinting (that emits warnings/notices/type warnings)
It would be nice to have such a vote so the coming RM's also have
control over which solution is preferered and eventually why its
preferered.
--
regards,
Kalle Sommer Nielsen
kalle@php.net