[squeak-dev] Re: The Inbox: Collections-hk.360.mcz

Andreas Raab andreas.raab at gmx.de
Fri May 21 02:48:43 UTC 2010


On 5/20/2010 11:29 AM, Herbert König wrote:
> FS>  So shouldn't there be (and I haven't looked for existing functionality)
> FS>  something like String>>isNumeric which says self isEmpty and: [self
> FS>  isAllDigits] ?
>
> Something like that would be my next resort, but "isNumeric" is
> misleading as it's also true for '-3'.
>
> FS>  I'm torn between my sense of logic and my desire to avoid bikeshedding.
>
> The reason to discuss it is, it might break existing code. My logic
> would be that isAllDigits is a pointed form of isDigits and
> '' isDigits is undoubtedly false (or so I hope).

Yeah, it's an interesting semantic difference. Do we mean the method to 
imply that "each character is a digit" (false for an empty string) or do 
we mean "there are no non-digits characters in it" (true for an empty 
string). I would lean towards the former but the argument for the latter 
can certainly be made.

Cheers,
   - Andreas



More information about the Squeak-dev mailing list