Re: Type hinting

From: Date: Mon, 24 May 2010 15:39:01 +0000
Subject: Re: Type hinting
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-48433@lists.php.net to get a copy of this message
Hi Zeev: On Mon, May 24, 2010 at 08:09:30AM +0300, Zeev Suraski wrote: > > 1. Implement the table along the lines of what it looks like now, > perhaps with minor changes. > 2. Implement identical conversion rules to the ones that exist in PHP; > That effectively turns type hinting into scalar casting operators (not > saying that's a bad thing!) > 3. Implement identical conversion rules to the ones that exist in PHP, > except for when they really suck. Namely, lose the array->scalar > conversions and silent conversions of non-numeric strings to numbers. My preference depends on what option 3 really means and what tweaks would be made to 1. I like the RFC's "list of examples" table over the recently added "zend_parse_parameters" table. Important changes to the example table seem to be: * string representations of int would be okay for int and float * string representations of float would be okay for float * _maybe_ have null and '' be okay as bool. On a side note, I hope the hinting will allow the ability to do something something like "int|null" for graceful handling of optional parameters. Thanks, --Dan -- T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y data intensive web and database programming http://www.AnalysisAndSolutions.com/ 4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409

« previous php.internals (#48433) next »