Re: Digit separators for numeric literals

From: Date: Thu, 19 Feb 2015 12:16:22 +0000
Subject: Re: Digit separators for numeric literals
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-83173@lists.php.net to get a copy of this message
2015-02-19 6:44 GMT+04:00 Rasmus Lerdorf <rasmus@lerdorf.com>: > > 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 999 999) U+1680 (although it looks too much like a -) > my_func(1 999 999) U+205F (mathematical space) > my_func(1٬999٬999) U+066C (Arabic thousands separator) > my_func(1·999·999) 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 > > Hey, Why not space? It's certainly possible (I just checked) and it would look clear I guess: my_func(1 999 999);

« previous php.internals (#83173) next »