Re: What do we need strict scalar type hints for?

From: Date: Mon, 02 Feb 2015 22:51:34 +0000
Subject: Re: What do we need strict scalar type hints for?
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-81668@lists.php.net to get a copy of this message
Hi Christoph, > On 2 Feb 2015, at 22:38, Christoph Becker <cmbecker69@gmx.de> wrote: > > And frankly, I don't see what's wrong with a weak type hint in this case: > > function addVat(float $amount) {...} > > You're returning a float, anyway. Given you’re dealing with currency, and given the fairly serious issues with precision loss with int->float conversions and vice-versa… I would be highly concerned if you used a weak type hint there. > OTOH, strict type hints would require a lot of manual conversions. Sure, they do. But they’re *explicit* manual conversions, ones you can easily grep for and that are obvious when reading code. -- Andrea Faulds http://ajf.me/

« previous php.internals (#81668) next »