Re: Locate repeated strings with the Tree
- --- In firstname.lastname@example.org, Luke Page <luke.a.page@...> wrote:
>Though 0 and 1 might be repeated several times, as any other numerical constant might, though in lesser numbers, I don't see a good reason to replace them by constants without a very good reason.
> I quite like this. I've modified it to be included in my visual studio
> extension as an option marked experimental.
> It's also occurred to me that 0 and 1 should be allowed for a = a + 1 and >=
> 1. Any other ok repeated constants?
> On 14 Feb 2011 22:34, "Deva Satyam" <satyam@...> wrote:
> [Non-text portions of this message have been removed]
It makes sense that codes turn into constants, like HTTP_OK = 200, and that is because it is a numeric code which has a meaning unrelated to its value as a number.
There is no reason to have ONE = 1 or ZERO = 0 since not all 0s and 1s mean the same. Besides, the program would not compress as much, as it does when replacing repeated strings by constants and certainly not run faster. Nor is it helpful in maintenance since 1 is always 1, but ONE might have any value and they don't help in typing as Math.PI does