SmallEiffel (-0.76): STRING.index_of does not conform to ELKS 2000
I noticed that SmallEiffel's index_of returns "count + 1" if the
character was not found, but ELKS requies "0" to be returned.
index_of(ch: CHARACTER): INTEGER is
-- Gives the index of the first occurrence `ch' or
-- `count + 1' if none.
Result := 1 + storage.fast_index_of(ch,count - 1);
(Result /= count + 1) implies (item(Result) = ch);
- --- Ulrich Windl" wrote:
> Hello,Hi Ulrich,
> I noticed that SmallEiffel's index_of returns "count + 1" if the
> character was not found, but ELKS requies "0" to be returned.
I seem to remember we had some discussion about the result of
'index_of' here. Another option was to just require
'valid_index(index_of(ch))' to be false in case 'ch' is not
contained in the string. The final decision was taken becaues
'0' is a fixed value, as far as I remember.
As I am in charge of making SE STRING ELKS2001 compliant (as soon
as ELKS2001 is finished), you can rest assured that this will be
corrected. At the moment STRING is still in the works and some
features have to be revisited before it can be finished, so it
would probably be a bad idea to make incomplete changes now.
In the meantime the query with 'valid_index' should be
used for compatibility. It might also be a sensible choice
to use 'valid_index' in general for these queries.
Arno Wagner Dipl. Inform. ETH Zuerich wagner@...
GnuPG:ID:F0C049F1 FP:8C E0 6F A5 CC B1 5A 11 ED C7 AD D2 05 5E BB 6F
"This software comes with ABSOLUTELY NO WARRANTY. Even if it erases
your hard drive, too bad. Although we did fix that bug from the last
release." --README from a long-ago release of DJGPP