> -----Original Message----- > From: Rowan Collins [mailto:rowan.coll...@gmail.com] > Sent: Wednesday, July 16, 2014 3:18 PM > To: internals@lists.php.net > Subject: Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening) > > Zeev Suraski wrote (on 16/07/2014): > > Secondly, if you do enable E_CAST - you may have to slightly*modify* > > your understanding of implicit casts, but you won't have to learn two > > different sets of rules. New users will see just one consistent set. > > I think I've got a bit lost: I thought you were saying implement the > concept of a > "lossless cast", but only emit a warning, not an error.
It's more of a lossy cast, exactly as we have today, that has an (effectively-optional-since-it's-off-by-default) to warn you about loss of data. For the vast majority of users who use the defaults, there'll be nothing new to learn except for the availability of those implicit casts in function signatures. For those who want to take advantage of 'loss protection', they'd have to learn about this extra warning type and clean their code so that it adheres to it. But there too, they'd have consistency, just one set of rules for implicit cast of scalar values across all of PHP. > Wherever and however we use it, we would have to invent a set of rules for > what "lossless cast" means, since we don't currently have one. > > I'm not sure what "two different sets of rules" you think other proposals > would create that this one doesn't. The proposal currently on the table implements two, simultaneously active sets of rules that in the long run everyone will have to be aware of. It has both the lossy and lossless concepts active in the same time, which means everyone will have to become familiar with the lossless rules, whether he's interested in that or not. Zeev -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php