Re: Scalar Type Hints v0.4
| From: | Lester Caine | Date: | Wed, 18 Feb 2015 09:54:57 +0000 |
| Subject: | Re: Scalar Type Hints v0.4 | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-83037@lists.php.net to get a copy of this message | ||
On 18/02/15 09:14, Andrey Andreev wrote:
> That is especially bad when such identifiers are in fact generated as
> integers first so that they are incremental, but the
> program/database/business logic requires them to be fixed-length
> strings and/or in hexadecimal format. In such cases, even silently
> discarding leading zeros can prove to be problematic, while in the
> case of hexadecimal representations you'd need more than 10 data
> samples to notice the problem if you don't use a strict hint.
> Obviously, that would be solved with automated testing, but
> unfortunately even code with high test coverage % often lacks depth in
> its test cases.
Octal is something that can often be miss converted since it IS the same
as an integer with only a '0' in front in PHP. But that is not something
that can be fixed with the current proposals? Again we have to ensure
that the pre-processing takes care of the problem and how would static
analysis even know there was a problem? A type hint following the SQL
standards would be more helpful than the javascript approach of giving
an error in strict mode.
--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk