Good evening and merry christmas,
After some discussion in a separated thread I created the RFC to discuss
about the implementation of another json_encode option.
The RFC can be found here:
https://wiki.php.net/rfc/json_preserve_fractional_part
Juan Basso
Good evening and merry christmas,
After some discussion in a separated thread I created the RFC to discuss
about the implementation of another json_encode option.The RFC can be found here:
https://wiki.php.net/rfc/json_preserve_fractional_partJuan Basso
Hi,
While I can see there’s some benefit to this when dealing with poorly-written JSON parsers, I think that we definitely shouldn’t make this behaviour the default.
Thanks.
--
Andrea Faulds
http://ajf.me/
Good evening and merry christmas,
After some discussion in a separated thread I created the RFC to discuss
about the implementation of another json_encode option.The RFC can be found here:
https://wiki.php.net/rfc/json_preserve_fractional_partJuan Basso
Hi,
While I can see there’s some benefit to this when dealing with
poorly-written JSON parsers, I think that we definitely shouldn’t make this
behaviour the default.
AFAIK that is only mentioned under the future scope, so deciding about that
is out-of-scope for the current RFC.
Ferenc Kovács
@Tyr43l - http://tyrael.hu
Hi!
Good evening and merry christmas,
After some discussion in a separated thread I created the RFC to discuss
about the implementation of another json_encode option.The RFC can be found here:
https://wiki.php.net/rfc/json_preserve_fractional_part
Completely makes sense for me as an option, for 5.6 and maybe even 5.5.
As a default, not so sure, but this should not hold adding an option.
--
Stas Malyshev
smalyshev@gmail.com
Exactly. The idea of this RFC is just to add as a new option and not
enabled by default.
The idea to enable it by default was discussed before and I just added as
future scope since it is not an easy decision, especially because the
backward compatibility. The main goal is to have the option to choose any
of the behaviors.
On Thu, Dec 25, 2014 at 7:54 PM, Stanislav Malyshev smalyshev@gmail.com
wrote:
Hi!
Good evening and merry christmas,
After some discussion in a separated thread I created the RFC to discuss
about the implementation of another json_encode option.The RFC can be found here:
https://wiki.php.net/rfc/json_preserve_fractional_partCompletely makes sense for me as an option, for 5.6 and maybe even 5.5.
As a default, not so sure, but this should not hold adding an option.--
Stas Malyshev
smalyshev@gmail.com
The RFC can be found here:
https://wiki.php.net/rfc/json_preserve_fractional_part
Hey Juan,
A further thought: is “Preserve Fractional Part” the best name? Integral floats like float(12) don’t have any fractional part, and besides, the name doesn’t tell you what it does IMO. Perhaps something like JSON_FLOAT_ADD_POINT_ZERO? It’s more literal and, I think, more obvious.
Thanks.
--
Andrea Faulds
http://ajf.me/
Andrea,
I am not a specialist in float numbers, but I think integral float numbers
have a fractional part with value 0.
JSON_FLOAT_ADD_POINT_ZERO can be confuse for regular floats with non-zero
as fractional part. Seems you are going to add a point zero in a regular
float with point something.
Anyway, I am open to rename the constant to make it clear for everyone. I
just can't find a better name than that. By the way, this name was proposed
by Kevin Israel (plstand) on the PR.
The RFC can be found here:
https://wiki.php.net/rfc/json_preserve_fractional_partHey Juan,
A further thought: is “Preserve Fractional Part” the best name? Integral
floats like float(12) don’t have any fractional part, and besides, the name
doesn’t tell you what it does IMO. Perhaps something like
JSON_FLOAT_ADD_POINT_ZERO? It’s more literal and, I think, more obvious.Thanks.
--
Andrea Faulds
http://ajf.me/
Hi,
Everyone has any concern on the constant name as Andrea mentioned? Should
we keep or rename it? If this name is fine and there is no other concerns
probably in 3 days (when completes 2 weeks) this RFC can be moved to
voting, right?
Thanks,
Juan Basso
Andrea,
I am not a specialist in float numbers, but I think integral float numbers
have a fractional part with value 0.JSON_FLOAT_ADD_POINT_ZERO can be confuse for regular floats with non-zero
as fractional part. Seems you are going to add a point zero in a regular
float with point something.Anyway, I am open to rename the constant to make it clear for everyone. I
just can't find a better name than that. By the way, this name was proposed
by Kevin Israel (plstand) on the PR.The RFC can be found here:
https://wiki.php.net/rfc/json_preserve_fractional_partHey Juan,
A further thought: is “Preserve Fractional Part” the best name? Integral
floats like float(12) don’t have any fractional part, and besides, the name
doesn’t tell you what it does IMO. Perhaps something like
JSON_FLOAT_ADD_POINT_ZERO? It’s more literal and, I think, more obvious.Thanks.
--
Andrea Faulds
http://ajf.me/
Hi,
Everyone has any concern on the constant name as Andrea mentioned? Should
we keep or rename it? If this name is fine and there is no other concerns
probably in 3 days (when completes 2 weeks) this RFC can be moved to
voting, right?Thanks,
Juan Basso
I prefer the originally proposed constant name
(JSON_PRESERVE_FRACTIONAL_PART) over JSON_FLOAT_ADD_POINT_ZERO.
I've did a quick check and we have a constant called
FILTER_FLAG_ALLOW_FRACTION
so maybe JSON_PRESERVE_FRACTION would be a bit
simpler and consistent.
But that would still imply that without this option we truncate (non-zero)
fractional parts, so maybe something like JSON_PRESERVE_ZERO_FRACTION.
I think PRESERVE is better than ADD because we aren't really adding
something but making sure that it won't be lost through the json_encode.
--
Ferenc Kovács
@Tyr43l - http://tyrael.hu
I really like the new name and the consistence with the rest of php. If no
one else has a complain about it I will update the RFC and open for voting,
right?
Juan Basso
Hi,
Everyone has any concern on the constant name as Andrea mentioned? Should
we keep or rename it? If this name is fine and there is no other concerns
probably in 3 days (when completes 2 weeks) this RFC can be moved to
voting, right?Thanks,
Juan BassoI prefer the originally proposed constant name
(JSON_PRESERVE_FRACTIONAL_PART) over JSON_FLOAT_ADD_POINT_ZERO.
I've did a quick check and we have a constant called
FILTER_FLAG_ALLOW_FRACTION
so maybe JSON_PRESERVE_FRACTION would be a bit
simpler and consistent.
But that would still imply that without this option we truncate (non-zero)
fractional parts, so maybe something like JSON_PRESERVE_ZERO_FRACTION.
I think PRESERVE is better than ADD because we aren't really adding
something but making sure that it won't be lost through the json_encode.--
Ferenc Kovács
@Tyr43l - http://tyrael.hu
I renamed the constant name on the RFC. Can I open the voting?
I really like the new name and the consistence with the rest of php. If no
one else has a complain about it I will update the RFC and open for voting,
right?Juan Basso
Hi,
Everyone has any concern on the constant name as Andrea mentioned? Should
we keep or rename it? If this name is fine and there is no other concerns
probably in 3 days (when completes 2 weeks) this RFC can be moved to
voting, right?Thanks,
Juan BassoI prefer the originally proposed constant name
(JSON_PRESERVE_FRACTIONAL_PART) over JSON_FLOAT_ADD_POINT_ZERO.
I've did a quick check and we have a constant called
FILTER_FLAG_ALLOW_FRACTION
so maybe JSON_PRESERVE_FRACTION would be a bit
simpler and consistent.
But that would still imply that without this option we truncate
(non-zero) fractional parts, so maybe something like
JSON_PRESERVE_ZERO_FRACTION.
I think PRESERVE is better than ADD because we aren't really adding
something but making sure that it won't be lost through the json_encode.--
Ferenc Kovács
@Tyr43l - http://tyrael.hu
I renamed the constant name on the RFC. Can I open the voting?
Hey Juan,
It’s been long enough, and the constant name is a minor issue. Go for it.
:)
--
Andrea Faulds
http://ajf.me/