Re: Scalar Type Hints v0.4

From: Date: Wed, 18 Feb 2015 17:55:43 +0000
Subject: Re: Scalar Type Hints v0.4
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.internals 
Request: Send a blank email to internals+get-83099@lists.php.net to get a copy of this message
> On 18 בפבר׳ 2015, at 19:50, Rasmus Lerdorf <rasmus@lerdorf.com> wrote: > > On 02/18/2015 08:51 AM, François Laupretre wrote: >>> De : Pádraic Brady [mailto:padraic.brady@gmail.com] >>> >>> Careful, it helps not to call folk "radicals" if you intend to pursue >>> a compromise with them ;). >> >> Sorry, english is not my native language, and 'radical' may be offensive. >> >> I was just looking for a word for people who consider providing two modes is a >> pre-requisite to any discussion. >> >>> I wouldn't necessarily mind int->float - it's lossless assuming one way >>> only. >> >> It's lossless but it kills the 'strict' position. It can be claimed, one >> hand on the heart, this will be the only exception but, as use cases and side effects accumulate, we >> all know it will finish as a bunch of exceptions to a no-more strict mode, adding confusion where it >> is not needed. I guess the next one would be (int -> bool), and the rest would follow. > > We need to keep in mind that int->float isn't technically lossless. We > have a 53-bit IEEE754 mantissa to take account for here, so it is only > lossless for values below 36028797018963966 or so. We can limit ourselves to values below that limit. If you deal with values above it, be explicit about casting. Zeev

« previous php.internals (#83099) next »