Yeah but we can't only tailor to the default. If you cast "abc" to an integer today PHP will do the conversion (e.g. 0). I think we should stick to that paradigm and provide users with validation methods if they want to strictly validate...

Andi

At 03:56 PM 4/13/2006, Andrei Zmievski wrote:
By default type conversions will just output a warning. You will get exceptions if you set the U_CONV_ERROR_EXCEPTION flag.

-Andrei

On Apr 13, 2006, at 3:52 PM, Andi Gutmans wrote:

As you know, exceptions were designed to be user-land and not for internal functionality. I warned about that more exceptions were being integrated into the extensions; and I especially warned of ideas of integrating them into language constructs such as type hints and conversions. I don't have a good solution for this right now, except for adding a lot of bulk to C extensions and the core and making them overly complicated. Anyway, I'll discuss with Dmitry and see if he has any ideas I didn't think of.

re: this specific case. Is it really a good idea for a type conversion to throw an exception? People won't be expecting that from reading the code. They'd most likely only expect methods to throw exceptions...

Andi

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to