Re: RE: Optional scalar type hinting
| From: | Sam Barrow | Date: | Fri, 04 Jan 2008 00:33:03 +0000 |
| Subject: | Re: RE: Optional scalar type hinting | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-34381@lists.php.net to get a copy of this message | ||
It doesn't disable type conversion unless you specifically tell it to.
Plus the fact that if it issues an E_WARNING, your application will not
necessarily stop execution.
On Thu, 2008-01-03 at 14:30 -0800, Stanislav Malyshev wrote:
> > I don't get it. We already have type hinting, just not for scalars. The
>
> Type hinting for scalars is different because it disables one of the
> features of PHP language - conversion of scalar types into each other.
>
> > So, can we switch the mundane conversation from "should we have type
> > hinting" to "why don't we have scalar type hinting if we have non-scalar
> > type hinting?" That is the real conversation. Type hinting is here. It
>
> These are different kinds of typing, with different consequences. You do
> not convert DateTime into PEAR_Soap_Client routinely, nor such
> conversion can make any sense at all, so distinguishing between them is
> not the same as making hard distinction between integer and float and
> string, and disabling conversion between them.
> --
> Stanislav Malyshev, Zend Software Architect
> stas@zend.com http://www.zend.com/
> (408)253-8829 MSN: stas@zend.com
>