Re: Re: [RFC] Numeric Literal Separator

From: Date: Wed, 29 May 2019 18:33:57 +0000
Subject: Re: Re: [RFC] Numeric Literal Separator
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-105799@lists.php.net to get a copy of this message
On Wed, 29 May 2019 at 12:35, G. P. B. <george.banyard@gmail.com> wrote: > > Also I think those kind of magic numbers should be constants with > meaningful names, and it that case you could just compute them by adding > powers of ten. > E.g. DISCOUNT_IN_CENTS = 1 * 10^5 + 3 * 10^4 + 5 * 10^3; I agree naming things is important, but when I'm working with non-programmers (e.g. the people in the accounts department), and we have lots of numbers in front of us, something like: EXAMPLE_ON_BUDGET = 1_000_000; EXAMPLE_UNDER_BUDGET = 990_000; EXAMPLE_OVER_TARGET = 1_001_000; EXAMPLE_WAY_OVER_BUDGET = 1_100_000; is going to be way easier to read than either the version without underscore, and definitely easier than power of ten notation. cheers Dan Ack

« previous php.internals (#105799) next »