Re: Type hinting

From: Date: Thu, 27 May 2010 11:46:55 +0000
Subject: Re: Type hinting
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.internals 
Request: Send a blank email to internals+get-48511@lists.php.net to get a copy of this message
On Thu, May 27, 2010 at 13:43, Evert | Filemobile <evert@filemobile.com> wrote: > > On 2010-05-27, at 8:14 PM, Zeev Suraski wrote: > >> At 13:59 27/05/2010, Ilia Alshanetsky wrote: >>> Zeev, >>> >>> Auto-conversion does not validate input to the function/method, it merely obfuscates >>> the "wrong" input by converting it to desired type resulting in a potentially un-expected >>> value. I must say I am completely against the auto-conversion hint idea. >> >> All of PHP is built on that kind of conversion.  See Brian Moon's email for a >> detailed instructions. >> BTW - even if strict type checking was implemented, do you truly think people won't >> simply cast their inputs to make PHP shutup about "42" not being a valid int?  Let me >> assure you, they would.  You'd gain nothing - as a matter of fact you'd lose out a bit >> since "abc" strings or arrays will happily cast into (int), while with our proposed >> solution - they won't.. > > Is a 'scalar' typehint still being considered? It doesn't seem to suffer from > the conversion vs. typechecking argument. Currently, it's available in trunk: http://svn.php.net/viewvc?view=revision&revision=299707 -- Daniel Egeberg

« previous php.internals (#48511) next »