Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83141 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95918 invoked from network); 19 Feb 2015 02:44:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Feb 2015 02:44:54 -0000 Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain lerdorf.com designates 209.85.192.170 as permitted sender) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 209.85.192.170 mail-pd0-f170.google.com Received: from [209.85.192.170] ([209.85.192.170:33268] helo=mail-pd0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 32/43-08593-42E45E45 for ; Wed, 18 Feb 2015 21:44:54 -0500 Received: by pdjz10 with SMTP id z10so5629222pdj.0 for ; Wed, 18 Feb 2015 18:44:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type; bh=PyQLupP5Y48zucwmC85nxkAgBNbGZ6V3gDkqax/+EMU=; b=en7trNbe4sAz57eCuWiMiuSgDVA6ccCKyzFDRvxTtvQINpeT8AOu1T6vlycPYR0Ztx H9VAdBENnd8biSFZ6pKi/qAUdIWTJFexZnRm5UFGkKO+ykGdV8cvv0Sw/71jdMZAK4Rl 0itla6ywQaGTr3/PEoqub+XUfsHXX2l+csjykWyypjyaovFYZOeKbATnTan7LzE5oSZ7 L3tZEJAcgFd6Gp3iNIJJCR/Zrm02z+c5Yd2nsXL8MQXfRsASslLThZGnl9Top4+HW/oH Ir2oP7bqpFilVa1XWgzBSR/RyRLCDcN4aucWAJ0FxkO/RWjyy9CwHBtyxi9BehCO4lsE bVQA== X-Gm-Message-State: ALoCoQk3GAf7RihZ/bEhbMP1FWp+wYSMFOe5awMSHSEiopaHq2xRifbYM82dYijrdTBoKT93HSZH X-Received: by 10.70.42.102 with SMTP id n6mr3615638pdl.85.1424313889329; Wed, 18 Feb 2015 18:44:49 -0800 (PST) Received: from [192.168.200.14] (c-50-131-44-225.hsd1.ca.comcast.net. [50.131.44.225]) by mx.google.com with ESMTPSA id ki2sm22063035pdb.33.2015.02.18.18.44.47 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Feb 2015 18:44:47 -0800 (PST) Message-ID: <54E54E1E.1010906@lerdorf.com> Date: Wed, 18 Feb 2015 18:44:46 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Christoph Becker , PHP internals References: <54E5456E.4020103@gmx.de> In-Reply-To: <54E5456E.4020103@gmx.de> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cKHHSbfN8r6aGiAHeHfLkP6UV4hIcvKBx" Subject: Re: [PHP-DEV] Digit separators for numeric literals From: rasmus@lerdorf.com (Rasmus Lerdorf) --cKHHSbfN8r6aGiAHeHfLkP6UV4hIcvKBx Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 02/18/2015 06:07 PM, Christoph Becker wrote: > Hi internals! >=20 > A while ago a question was asked on the php-general mailing list with > regard to digit seperators in numeric literals[1]. >=20 > IMHO it might be a useful enhancement to allow such digit separators fo= r > numeric (integer and float) literals in PHP for better readability; > several other languages already support them (such as Java, Perl, Ruby,= > C#, Eiffel and C++14). >=20 > Before attempting to draft a respective RFC, I'd like to get some > feedback, whether this is generally considered to be useful, which > character would be preferred (most other languages seem to allow the > underscore, but an apostroph or maybe some other character might be > reasonable as well), and which restrictions should be applied (e.g. > arbitrary use of the separator, group thousands only, etc.) >=20 > I'm looking forward to hear your opinion. Thanks in advance. >=20 > [1] I think it will be difficult to find a separator character that doesn't make a mess of the grammar. my_func(1,999,999) obviously doesn't work my_func(1'999'999) as per C++14 clashes with our single-quoted strings my_func(1_999_999) like in ADA might work but _999_ would need to work as well and _ is a valid char in a constant so you can have a constant named _999_. - nope # nope @ nope ~ nope ! nope % nope ^ nope We went through this for the namespace char, and there simply isn't a typable single character left to use for something like this. _ is the closest but it would require some changes and BC breaks which I am not sure is worth for what appears to me to be a not-so critical feature. Now if we went into Unicode territory, we could do it. eg. my_func(1=E1=9A=80999=E1=9A=80999) U+1680 (although it looks too much l= ike a -) my_func(1=E2=81=9F999=E2=81=9F999) U+205F (mathematical space) my_func(1=D9=AC999=D9=AC999) U+066C (Arabic thousands separator) my_func(1=C2=B7999=C2=B7999) U+00B7 (middle dot) The last one looks best to me, but we'd need a team of people working in shifts to answer the, "How do I type this?" question. -Rasmus --cKHHSbfN8r6aGiAHeHfLkP6UV4hIcvKBx Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlTlTh4ACgkQlxayKTuqOuD3hQCeKbF65B7j+IbBsu2WpjHDga4G KAEAn0kcPNFTtYr8hpzaYpr16Eu+cugr =DsJ0 -----END PGP SIGNATURE----- --cKHHSbfN8r6aGiAHeHfLkP6UV4hIcvKBx--