Re: [PHP-DEV] Re: [RFC] [DISCUSSION] Locale-independent float to string cast

2020-04-22 Thread Máté Kocsis
Hi Guilliam,

Thank you for the reminder, we certainly forgot to resolve that issue.

After a quick investigation, it turned out that the %e and %E specifiers
are already
locale-insensitive, so we can leave them as-is.

Furthermore, the definition of the %G specifier according to the
documentation
is "Like the g specifier but uses E and F", which is not true, since %G is
always a
locale-dependent format, while %F is not.

That's why we think the way forward is to:
- fix the documentation independently of this RFC
- expose the %h and %H format specifiers which are "like the %g and %G
specifiers, but really use %e/%E and %f/%F respectively". Nikita is
currently
working on adding support for these, so it's also not a dependency of the
RFC.

That's why the vote is still scheduled for tomorrow.

Thanks,
Máté

(P.S: I've just seen that Nikita already wrote a similar answer)


Re: [PHP-DEV] Re: [RFC] [DISCUSSION] Locale-independent float to string cast

2020-04-22 Thread Nikita Popov
On Wed, Apr 22, 2020 at 10:53 AM Guilliam Xavier 
wrote:

> On Tue, Apr 21, 2020 at 10:01 PM Máté Kocsis 
> wrote:
> >
> > That said, we'd like to open the vote on Thursday, unless serious
> concerns
> > arise
> > in the meanwhile.
> >
> > Cheers,
> > Máté
>
> Hi, thanks for the work,
>
> Shouldn't the RFC mention the open question of printf formats %e/%E
> and %g/%G (and possible %H)?
>

I've started a separate thread to discuss related improvements to printf().
I believe the printf() improvements are useful independent of the outcome
of this RFC, and don't need to block this RFC from going forward.

Regards,
Nikita


Re: [PHP-DEV] Re: [RFC] [DISCUSSION] Locale-independent float to string cast

2020-04-22 Thread Guilliam Xavier
On Tue, Apr 21, 2020 at 10:01 PM Máté Kocsis  wrote:
>
> That said, we'd like to open the vote on Thursday, unless serious concerns
> arise
> in the meanwhile.
>
> Cheers,
> Máté

Hi, thanks for the work,

Shouldn't the RFC mention the open question of printf formats %e/%E
and %g/%G (and possible %H)?

-- 
Guilliam Xavier

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Re: [RFC] [DISCUSSION] Locale-independent float to string cast

2020-04-21 Thread Máté Kocsis
Hi Andrea,

Thank you for the suggestions! The wording of the RFC has been changed,
and now it includes a link to the list of countries which use . as a decimal
separator.

Also, I updated the list of functions that change behaviour, even though
there are only two newly added items: implode() and an XML-RPC related
function.

We tried to come up with an exhaustive list of functions which are going to
be affected,
however due to the weak typing semantics it is nearly impossible to make an
accurate
exhaustive list, but we hope the list provided covers the most common cases.

That said, we'd like to open the vote on Thursday, unless serious concerns
arise
in the meanwhile.

Cheers,
Máté


[PHP-DEV] Re: [RFC] [DISCUSSION] Locale-independent float to string cast

2020-04-15 Thread Andrea Faulds

Hi,

Máté Kocsis wrote:

Hi Internals,

Together with George, I'd like to propose an RFC for a long-standing
problem PHP has:
casting floats to string depends on the locale settings. As this behaviour
is nonsense, and
because it can cause quite serious problems, we would like to get rid of
locale-dependence
in PHP 8.

Please find our RFC at
https://wiki.php.net/rfc/locale_independent_float_to_string.

Regards,
George and Máté



Just a little thing, saying “certain locales (notably the German, 
French, and Spanish ones)” perhaps understates the issue. Most 
non-English-speaking countries do not use . as the decimal separator! 
https://en.wikipedia.org/wiki/Decimal_separator#Arabic_numerals


Anyway, thank you for this RFC, I think fixing this is long, long 
overdue. I expect there could be a serious BC impact for certain PHP 
users, but I don't think there is a good long-term solution for this 
short of forcing such code to be updated.


As a potential improvement, I would suggest to try to be closer to 
comprehensive in documenting which functions' behaviour changes or does 
not. For example, this RFC doesn't currently say what happens to 
settype() and print_r().


Thanks,
Andrea

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php