Re: type hinting

From: Date: Sun, 06 Jan 2008 21:48:09 +0000
Subject: Re: type hinting
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.internals 
Request: Send a blank email to internals+get-34555@lists.php.net to get a copy of this message
Hello Pierre, I agree something that is not really a number should not be converted into a number as it is not compatible but then...what do we do right now? [marcus@zaphod PHP_5_3]$ php -r 'var_dump(fmod(12,5));' make: `sapi/cli/php' is up to date. float(2) [marcus@zaphod PHP_5_3]$ php -r 'var_dump(fmod("12","5"));' make: `sapi/cli/php' is up to date. float(2) [marcus@zaphod PHP_5_3]$ php -r 'var_dump(fmod("12","5a"));' make: `sapi/cli/php' is up to date. float(2) [marcus@zaphod PHP_5_3]$ php -r 'var_dump(fmod("12b","5a"));' make: `sapi/cli/php' is up to date. float(2) So we do allow "12b" to be used as 12 even. Oh screw us all :-) marcus Sunday, January 6, 2008, 9:53:10 PM, you wrote: > Hi Marcus, > On Jan 6, 2008 9:24 PM, Marcus Boerger <helly@php.net> wrote: >> That said I would only agree to type hints if we make them respect existing >> PHP conversion rules. > That can be a good compromise and may make happy the cons camp. > However, I would not like to have "11an" returns 0 but raises an > error. I can live with "[0-1.]" being converted to integer or float as > it is the case now. Even I would rather prefer a strict hinting and > let the user of a method or function do the cast (for the reasons > explained numerous times in this thread). > -- > Pierre > http://blog.thepimp.net | > http://www.libgd.org Best regards, Marcus

« previous php.internals (#34555) next »