Hi Zeev: On Wed, Jun 09, 2010 at 05:17:13PM +0300, Zeev Suraski wrote: > > I think having E_TYPE (or whatever), a non-fatal notice that can be > either ignored or handled separately from everything else makes sense. I > think we may actually want to introduce it at the most basic levels of > PHP, so that whenever data loss occurs (except for explicit casts) - an > E_TYPE warning will be generated. That will bring consistency between > the new type hinting and the rest of PHP. Thoughts?
Intersting. Knowing when data is being lost in any situation can be helpful. At the same time, guaranteeing a function call signature is somewhat different than noticing a change in the general code. Perhaps two new error types? Though that may not be practical, depending on how the engine's logic works. > Regarding having an API that allows you to access the original > unconverted value and/or its type - I don't think we should go in that > direction. Presently this information is not retained in any way, and > retaining it would be quite a headache Yeah, I don't know much about what the engine keeps track of. But I do know that E_NOTICE's tell one the name of the variable that is undefined. And debug backtraces can show one the call stack. So there's some stuff being tracked. While my initial suggestion called for tracking new information, that's not essential. Getting at the information that is available by some way other than parsing the error string with a regular expression would be really nice. > why not simply avoid using > type hinting, and perform type/value checks in the function body instead? That's completely doable. It seems type hinting is supposed to cut down on the need to do that. Thanks for thinking about this, --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 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php