[RFC][VOTE] Number Format Separator

php.internals

Thomas Punt

10 years ago
Hi internals! Voting has opened for the inclusion of a digit separator in PHP[1]. Voting ends in one week's time on January 20th. Thanks, Tom [1]: http://wiki.php.net/rfc/number_format_separator

Björn Larsson

10 years ago
Den 2016-01-13 kl. 19:48, skrev Thomas Punt:
> Hi internals! > > Voting has opened for the inclusion of a digit separator in PHP[1]. Voting ends in > one week's time on January 20th. > > Thanks, > Tom > > [1]: http://wiki.php.net/rfc/number_format_separator
Well, if I had a vote it would definetly be +1. A small question though, why is the voting period only one week (small RFC or)? Regards //Björn Larsson

Thomas Punt

10 years ago
Hi Björn, > Well, if I had a vote it would definetly be +1. A small question > though, why is the voting period only one week (small RFC or)? The RFC is quite simple and short, so I thought a one week voting period would suffice. I'm more than happy to extend this though if people don't think they'll have time to review it within the next week. > Regards //Björn Larsson -Tom

Björn Larsson

10 years ago
Den 2016-01-14 kl. 18:21, skrev Thomas Punt:
> Hi Björn, > >> Well, if I had a vote it would definetly be +1. A small question >> though, why is the voting period only one week (small RFC or)? > The RFC is quite simple and short, so I thought a one week voting period would > suffice. I'm more than happy to extend this though if people don't think they'll > have time to review it within the next week. > >> Regards //Björn Larsson > -Tom
Well, even if it's small one there could be a value in having a slightly longer voting period. Just thought that many CoC mails on the list now takes focus. Still, no point in making a hen out of a feather :-) Regards //Björn PS I'm not sure the RFC process allows to change voting period once the voting is opened.

Andrew Faulds

10 years ago
Hi Thomas, Thomas Punt wrote:
> Hi internals! > > Voting has opened for the inclusion of a digit separator in PHP[1]. Voting ends in > one week's time on January 20th. > > Thanks, > Tom > > [1]: http://wiki.php.net/rfc/number_format_separator >
Initially I was going to abstain from this vote, but I've changed my mind and I am now voting in favour of the RFC. When choosing whether to add features to the language, we must set a high standard, because every new additions means additional complexity and more knowledge PHP developers have to have. So, every new addition should be made to fit well with existing features, be useful, and This feature offers some benefit in some cases. It doesn't introduce much new complexity. There's no new syntax or tokens, it just modifies the form of the existing number tokens. It fits in well what's already there, consistently applying to all number literals. It follows established convention in other languages. Its appearance at least hints that values with these seperators are not constants or identifiers, but numbers, reducing potential for confusion. It limits its own application to prevent abuse (no leading, trailing, or repeated separators). And it's relatively intuitive. So I think it might be worth adding, thus my vote. Though we must be conservative with additions, this one doesn't seem to be too problematic. That said, I might be voting the wrong way. The feature does seem to have limited applicability. That's really the only thing I can say against it. Thanks.
-- Andrea Faulds https://ajf.me/

Björn Larsson

10 years ago
Den 2016-01-16 kl. 02:40, skrev Andrea Faulds:
> Hi Thomas, > > Thomas Punt wrote: >> Hi internals! >> >> Voting has opened for the inclusion of a digit separator in PHP[1]. >> Voting ends in >> one week's time on January 20th. >> >> Thanks, >> Tom >> >> [1]: http://wiki.php.net/rfc/number_format_separator >> > > Initially I was going to abstain from this vote, but I've changed my > mind and I am now voting in favour of the RFC. > > When choosing whether to add features to the language, we must set a > high standard, because every new additions means additional complexity > and more knowledge PHP developers have to have. So, every new addition > should be made to fit well with existing features, be useful, and > > This feature offers some benefit in some cases. It doesn't introduce > much new complexity. There's no new syntax or tokens, it just modifies > the form of the existing number tokens. It fits in well what's already > there, consistently applying to all number literals. It follows > established convention in other languages. Its appearance at least > hints that values with these seperators are not constants or > identifiers, but numbers, reducing potential for confusion. It limits > its own application to prevent abuse (no leading, trailing, or > repeated separators). And it's relatively intuitive. > > So I think it might be worth adding, thus my vote. Though we must be > conservative with additions, this one doesn't seem to be too problematic. > > That said, I might be voting the wrong way. The feature does seem to > have limited applicability. That's really the only thing I can say > against it. > > Thanks. >
One could add that for programmers coming from another language using _ as number separator there is a value in having the same functionality. No need to relearn at all... Came to think on license keys for games. They always have a separator (using -) to increase readability. Which leads me to thinking, could the proposed number separator be used in cryptographic keys and is there a value in that? Regards //Björn

Andrew Faulds

10 years ago
Hi Björn, Björn Larsson wrote:
> Den 2016-01-16 kl. 02:40, skrev Andrea Faulds: > One could add that for programmers coming from another language > using _ as number separator there is a value in having the same > functionality. No need to relearn at all...
Yes, this is a fair point.
> Came to think on license keys for games. They always have a separator > (using -) to increase readability. Which leads me to thinking, could the > proposed number separator be used in cryptographic keys and is there > a value in that?
I think most crytographic keys are greater than 64 bits, so won't be represented in PHP with integers and therefore can't benefit from this. But if they're strings, you could break them up into chunks and concatenate them, I suppose. Thanks!
-- Andrea Faulds https://ajf.me/

Stas Malyshev

10 years ago
Hi!
> Came to think on license keys for games. They always have a separator > (using -) to increase readability. Which leads me to thinking, could the > proposed number separator be used in cryptographic keys and is there > a value in that?
Probably not. Crypto keys are usually pretty long integers, which would not fit into standard PHP number. If you want to do your own crypto in PHP (which is usually not recommended unless you *really really* know what you are doing) then you'd use something like GMP. But most likely, you would use standard crypto libraries and standard key storage formats like PKCS #1.
-- Stas Malyshev smalyshev@gmail.com

Yasuo Ohgaki

10 years ago
Hi all, On Sat, Jan 16, 2016 at 10:40 AM, Andrea Faulds <ajf@ajf.me> wrote:
> > Thomas Punt wrote: >> >> Hi internals! >> >> Voting has opened for the inclusion of a digit separator in PHP[1]. Voting >> ends in >> one week's time on January 20th. >> >> Thanks, >> Tom >> >> [1]: http://wiki.php.net/rfc/number_format_separator >> > > Initially I was going to abstain from this vote, but I've changed my mind > and I am now voting in favour of the RFC. > > When choosing whether to add features to the language, we must set a high > standard, because every new additions means additional complexity and more > knowledge PHP developers have to have. So, every new addition should be made > to fit well with existing features, be useful, and > > This feature offers some benefit in some cases. It doesn't introduce much > new complexity. There's no new syntax or tokens, it just modifies the form > of the existing number tokens. It fits in well what's already there, > consistently applying to all number literals. It follows established > convention in other languages. Its appearance at least hints that values > with these seperators are not constants or identifiers, but numbers, > reducing potential for confusion. It limits its own application to prevent > abuse (no leading, trailing, or repeated separators). And it's relatively > intuitive. > > So I think it might be worth adding, thus my vote. Though we must be > conservative with additions, this one doesn't seem to be too problematic. > > That said, I might be voting the wrong way. The feature does seem to have > limited applicability. That's really the only thing I can say against it.
The same opinion. The syntax is popular enough and doesn't add much complexity, but it seems this RFC wouldn't pass. Large numeric literals are not used often. However if it is used, it's frustrating to read. e.g. Code audit/review. Why not make computer do the job? I hope more people change their mind. Regards,
-- Yasuo Ohgaki yohgaki@ohgaki.net

Lester Caine

10 years ago
On 18/01/16 08:12, Yasuo Ohgaki wrote:
> Large numeric literals are not used often. However if it is used, it's > frustrating to read. e.g. Code audit/review. Why not make computer > do the job? > > I hope more people change their mind.
Where large numbers are used, adding them as strings using the local format is already used? This just adds yet another 'option' to how they can be entered but is something which makes reading in the context of the local use MORE of a problem? My main need would be hexadecimal code which is not covered, so I still need the alternate hacks anyway.
-- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

Leigh

10 years ago
On 18 January 2016 at 12:22, Lester Caine <lester@lsces.co.uk> wrote:
> > My main need would be hexadecimal code > which is not covered, so I still need the alternate hacks anyway. >
Hex is covered, see the first examples in the "Proposal" section

Lester Caine

10 years ago
On 18/01/16 12:25, Leigh wrote:
> My main need would be hexadecimal code > which is not covered, so I still need the alternate hacks anyway. > > Hex is covered, see the first examples in the "Proposal" section
Sorry getting mixed up ;) Can't use the 0x in some areas, so one ends up with an alternate method of adding the data as hex ... with it's own separator ... but for the life of me I can't find why we had to do that now. This may be down to BIGINT and 64bit numbers in databases ... that is where the data ends up and I know the 0x was a problem - or was it octal input
-- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

Björn Larsson

10 years ago
Den 2016-01-18 kl. 13:22, skrev Lester Caine:
> On 18/01/16 08:12, Yasuo Ohgaki wrote: >> Large numeric literals are not used often. However if it is used, it's >> frustrating to read. e.g. Code audit/review. Why not make computer >> do the job? >> >> I hope more people change their mind. > Where large numbers are used, adding them as strings using the local > format is already used? This just adds yet another 'option' to how they > can be entered but is something which makes reading in the context of > the local use MORE of a problem? My main need would be hexadecimal code > which is not covered, so I still need the alternate hacks anyway. >
Hm... I got the impression it was covered by reading the two last examples of: "Enable for arbitrary grouping of digits". Did I read it to quick? r//Björn

Pascal MARTIN

10 years ago
Le 13/01/2016 19:48, Thomas Punt a écrit :
> Voting has opened for the inclusion of a digit separator in PHP[1]. Voting ends in > one week's time on January 20th.
Hi, At AFUP, we would be on the -1 side (by a huge margin). The "good" thing would be code that's a bit more readable, yes. But it would be harder to search in code, as there would be more than one way to write a number. Basically, it would break grep/find. Splitting numbers so they are more readable is kind of a presentation matter and, as such, could be done by an editor/IDE when displaying code, without having to modify the code by hand (actually, I'm quite surprised it's not a feature I remember seeing in any IDE). In any case, thanks for you work on this!
-- Pascal MARTIN, AFUP - French UG http://php-internals.afup.org/

Andrew Faulds

10 years ago
Hi Pascal, Pascal MARTIN, AFUP wrote:
> Le 13/01/2016 19:48, Thomas Punt a écrit : >> Voting has opened for the inclusion of a digit separator in PHP[1]. >> Voting ends in >> one week's time on January 20th. > > Hi, > > At AFUP, we would be on the -1 side (by a huge margin). > > The "good" thing would be code that's a bit more readable, yes. > > But it would be harder to search in code, as there would be more than > one way to write a number. Basically, it would break grep/find. > > Splitting numbers so they are more readable is kind of a presentation > matter and, as such, could be done by an editor/IDE when displaying > code, without having to modify the code by hand (actually, I'm quite > surprised it's not a feature I remember seeing in any IDE). > > In any case, thanks for you work on this!
One other approach I thought of is to use constant scalar expressions: +('123'.'456'.'789') It's not quite the same of native support, but it works. Thanks.
-- Andrea Faulds https://ajf.me/

Yasuo Ohgaki

10 years ago
Hi Andrea, On Thu, Jan 21, 2016 at 4:18 AM, Andrea Faulds <ajf@ajf.me> wrote:
> > One other approach I thought of is to use constant scalar expressions: > > +('123'.'456'.'789') > > It's not quite the same of native support, but it works.
This is what I do on occasions. I have to read var_export()ed PHP code sometimes. If PHP supports this RFC and var_export() support it, it would be much easier to read. It's irrelevant for this RFC, but if PHP supports compile time string concatenation echo "Very long sting " "that is concatenated " "at compile time."; It would be nice to have. Regards,
-- Yasuo Ohgaki yohgaki@ohgaki.net

Thomas Punt

10 years ago
Hi internals! > Voting has opened for the inclusion of a digit separator in PHP[1]. Voting ends in > one week's time on January 20th. Voting has now ended with 20 for and 18 against. This means the RFC has been declined. Thank you to all who participated in the RFC discussion and voting! -Tom

Björn Larsson

10 years ago
Den 2016-01-20 kl. 21:42, skrev Thomas Punt:
> Hi internals! > >> Voting has opened for the inclusion of a digit separator in PHP[1]. Voting ends in >> one week's time on January 20th. > Voting has now ended with 20 for and 18 against. This means the RFC has been > declined. > > Thank you to all who participated in the RFC discussion and voting! > > -Tom
Thanks for the good work. Many voters but not so much discussion on the list before voting. Slightly surprised it didn't pass actually. Regards //Björn Larsson