From: Eric B. <er...@go...> - 2007-02-03 21:07:41
|
Colin Paul Adams wrote: >>>>>> "Eric" == Eric Bezault <er...@go...> writes: > > Eric> I had a look at the routines `is_integer_64' and > Eric> `to_integer_64' in class KL_STRING_ROUTINES. And there are > Eric> two things that I don't like. The first thing is that they > Eric> create too many temporary objects (calling `substring', > Eric> creating manifest arrays). > > Yes. I wasn't happy with that myself. > > Eric> The second thing that I don't > Eric> like is the precondition "is_integer". I don't think that it > Eric> is a good idea to have to write: > > Eric> is_integer (s) and then is_integer_64 (s) > > Well I thought about that. > And I thought about the use case I have, which is parsing > numbers. The tokenizer has already created tokens one of which is > certified to consist entirely of decimal digits (there may be a > preceding token consisting of a minus sign). > In this use case the pre-condition "is_integer" is guarenteed true. > > So I tried to think about other use cases for "is_integer_64". All I > could think of was parsing, and I presumed therefore that the > pre-condition would always be satisfied. I think that this assumption is too strong for a general purpose library class like KL_STRING_ROUTINE. It would have been OK if this routine was part of your parsing class, but here with KL_STRING_ROUTINE we cannot make such an assumption. -- Eric Bezault mailto:er...@go... http://www.gobosoft.com |