Anthony Ferrara wrote:
So, what do you think?
I am a big fan of this style. Accepting e.g. "1abc" as int(1) with a
notice seems like a better solution than anything else. A full error
would be too much towards strict typing (I wouldn't mind personally, but
others do have a strong opinion on this, as we've seen).
The only thing I'm not so crazy about is foob('abc') -> bool(true). I
can live with it, but I don't particularly like it as far as the typing
goes.
Ilia Alshanetsky wrote:
> My concern with this type of patch is that what you are proposing are
> not really hints, they are forced casts. As such they modify the data
> potentially leading to data loss.
I disagree with Ilia on this, as the casts are only made if they can be
converted properly, and give E_RECOVERABLE_ERROR instead. Anything
that's going to have significant data loss is covered by that.
Bottom line: I'd personally use this, while I certainly would not use
the previous style (with `(int) $foo` e.g.).
--
Ryan McCue
<http://ryanmccue.info/>
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php