Re: Reviving scalar type hints
| From: | Lester Caine | Date: | Tue, 17 Feb 2015 15:03:49 +0000 |
| Subject: | Re: Reviving scalar type hints | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-82969@lists.php.net to get a copy of this message | ||
On 17/02/15 14:49, Andrey Andreev wrote:
>> I agree. It's more of a question of eliminating potentially dangerous
>> > conversions than just being lossless.
>> >
> Agreed as well. However, while bool -> int conversion one of the
> reasons why many people want strict type-hints, it also often makes
> sense and is quite widespread. There's no silver bullet for that
> problem.
Returning 'not-zero/empty' as true and 'zero' as false is one of the
natural things to use in PHP and I don't think any other language has
that flexibility? It is also why some of the other 'little changes' such
as hard coded IS_TRUE and IS_FALSE are actually somewhat alien!
Certainly is does not play well with my methods of working, but then I
prefer a function to return a result rather than crash out with an
exception ... Although -ve values are even more useful than a simple
'zero' return and that may replace a string return.
--
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