Re: [bugs] [PATCH] Fix integer parsing
- Date: Tue, 05 Dec 2017 08:36:04 +0100
- From: Lukas Fleischer <lfleischer@xxxxxxxxxxxx>
- Subject: Re: [bugs] [PATCH] Fix integer parsing
On Fri, 01 Dec 2017 at 18:05:19, Lars Henriksen wrote:
> Well, yes, if you insist that is_all_digit() should return true on an empty
> string, but I am not convinced. You wrote:
> A member of the empty set has any property you may care to ask about. That's
> true, but as interesting as 1 = 1. The logic is impeccable, but is it useful?
> In a way you have supplied the answer yourself.
Not quite. Having a function called is_all_digit() return true on the
empty string is the only sensible behavior. However...
> Let's forget the +/- issue which is not the point. You have a string which you
> would like to interpret as an integer. Can you just give it to is_all_digit()?
> Not with your semantics, because if it returns true, all you know is that it
> does not contain a character that is not a digit. So you check whether the
> first character is a digit and leave the rest to is_all_digit(). That is odd.
> The first character is checked "by hand", the rest is left to a supporting
I am fine with changing the semantics as you suggested and rename the
function to is_numeric() (or any other name you like which describes the