Re: [PHP-DEV] [VOTE][RFC] Scalar Type Hinting with Cast

[email protected] (Pierre Joye)
Newsgroups php.internals
Message-ID <CAEZPtU67WPWPj7FMtEPjFQLLuOkR-5sokCNanaK-XOMvLYz__Q@mail.gmail.com>
On Sun, Sep 14, 2014 at 11:12 AM, Alain Williams <[email protected]> wrote:
> On Sun, Sep 14, 2014 at 01:10:20AM +0100, Andrea Faulds wrote:
>>
>> On 14 Sep 2014, at 01:07, Alain Williams <[email protected]> wrote:
>>
>> > You give an option for float to int casting to truncate.
>>
>> Where?
>
>     Possible Changes
>
>     Float to Int Casting Rules
>
> ...
>
>     This could be relaxed for semi-representable values. So 1.5 could be allowed
>     for an int parameter (casted to 1).

That's one thing I do not like much. If one accepts both int and
float, numeric should be used instead. But allowing float for int and
raises warnings on data losses is just awkward imho.

-- 
Pierre

@pierrejoye | http://www.libgd.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.