Hi,

On Tue, Nov 4, 2014 at 6:14 PM, Andrea Faulds <a...@ajf.me> wrote:

>
> > On 4 Nov 2014, at 17:07, Jakub Zelenka <bu...@php.net> wrote:
> >
> > I would really like to see it as default in the next major as it is a
> > useful feature.
> >
> > However I don't like adding new flag. The reason for that is that it
> > becomes useless after 7 is realesed. It would be useful only for >5.6.3
> and
> > <7.0 though. The only use case in PHP 7 would be just to disable the flag
> > but that won't be very nice and completely different than other json
> > constant usage It means doing something like $options &
> > ~JSON_PRESERVE_FRACTIONAL_PART ... It's a bit messy IMHO. Think that it
> > would be much better to wait till 7 with this feature.
>
> I really don’t like the idea of making this the default. On 32-bit
> systems, floats give you, effectively, extra integer range up until you hit
> 2^52, and indeed all JS integer values are just floats within that range. I
> don’t think they should be represented as floats. It’d go weirdly with
> 64-bit PHP, which can decode such values to integers, which would then not
> handle the range beyond 2^52 nicely.
>

That's a good point. However I still think that there are more advantages
for making this the default. I like mainly the idea that
json_decode(json_encode($a)) = $a for all floats which is not the case at
the moment. Also it allow some other things that were mentioned before.

Think that we will probably need an RFC for that as we apparently don't
have a consensus about this.

Cheers

Jakub

Reply via email to