CVS difference for ai05s/ai05-0056-1.txt

Differences between 1.1 and version 1.2
Log of other versions for file ai05s/ai05-0056-1.txt

--- ai05s/ai05-0056-1.txt	2007/05/24 01:17:03	1.1
+++ ai05s/ai05-0056-1.txt	2007/07/26 02:58:06	1.2
@@ -1,14 +1,7 @@
-!standard A.4.3(56.2/2)                              07-05-23    AI05-0056-1/01
-!standard A.4.3(58/2)
-!standard A.4.3(58.1/2)
-!standard A.4.3(58.2/2)
-!standard A.4.3(58.3/2)
+!standard A.4.3(56.2/2)                              07-06-17    AI05-0056-1/02
 !standard A.4.3(58.5/2)
-!standard A.4.3(60/2)
-!standard A.4.3(60.1/2)
-!standard A.4.3(60.2/2)
-!standard A.4.3(60.3/2)
 !class binding interpretation 07-05-23
+!status ARG Approved  8-0-2  07-06-02
 !status work item 07-05-23
 !status received 07-05-10
 !priority Low
@@ -18,7 +11,7 @@
 
 !summary
 
-Index returns 0 when searching a null string; it does not
+All versions of Index return 0 when searching a null string; they do not
 raise Index_Error.
 
 !question
@@ -43,62 +36,50 @@
 
 !wording
 
-Replace A.4.3(56.2/2) by:
+In A.4.3(56.2/2), add "If Source is the null string, Index returns 0; otherwise,"
+before "If From is not in...".
 
-If From is not in Source'Range, then Index_Error is propagated. 
-Otherwise if Going = Forward, returns
-   Index (Source(From .. Source'Last), Pattern, Forward, Mapping); 
-otherwise returns
-   Index (Source(Source'First .. From), Pattern, Backward, Mapping);
-
-Replace A.4.3(58-58.3/2) by (this is the original Ada 95 wording):
-
-Each Index function searches for a slice of Source, with length
-Pattern'Length, that matches Pattern with respect to Mapping; the
-parameter Going indicates the direction of the lookup. If
-Going = Forward, then Index returns the smallest index I such that
-the slice of Source starting at I matches Pattern.
-If Going = Backward, then Index returns the largest index I such
-that the slice of Source starting at I matches Pattern. If there
-is no such slice, then 0 is returned. If Pattern is the null string
-then Pattern_Error is propagated.
-
-Replace A.4.3(58.5/2) by:
-
-If From is not in Source'Range, then Index_Error is propagated. 
-Otherwise if Going = Forward, returns
-   Index (Source(From .. Source'Last), Set, Test, Forward); 
-otherwise returns
-   Index (Source(Source'First .. From), Set, Test, Backward);
-
-Replace A.4.3(60-60.3/2) by (this is the original Ada 95 wording):
-
-Index searches for the first or last occurrence of any of a set
-of characters (when Test=Inside), or any of the complement of a
-set of characters (when Test=Outside). It returns the smallest
-index I (if Going=Forward) or the largest index I (if
-Going=Backward) such that Source(I) satisfies the Test condition
-with respect to Set; it returns 0 if there is no such Character
-in Source.
+In A.4.3(58.5/2), add "If Source is the null string, Index returns 0; otherwise,"
+before "If From is not in...".
 
 !discussion
 
-Note that the same problem occurs in the wording for the set version of
-Index.
-
-Patching up the Amendment wording would require adding a lengthy sentence to
-A.4.3(58/2) and A.4.3(60/2) to cover the case of a null string (which should
-return 0, unless the pattern is null). That is longer than the original wording,
-and still has the possibility of incompatibilites. As such we restore the
-Ada 95 wording for A.4.3(58/2) and A.4.3(60/2).
-
-In order to avoid unnecessary diferences between these functions, we reword
-the new A.4.3(56.2/2) and A.4.3(58.5/2). (The author of the original wording
-considered this option originally, but didn't do it thinking it would be
-shorter and simpler the other way, which did not turn out to be true.)
-
-
---!corrigendum A.4.3(26/2)
+The problem is that calling Index ("", ...) should always return 0, irrespective
+of the presence of From or its value. Note that the same problem occurs in
+the wording for the set version of Index.
+
+We considered making the various versions of Index different in this respect, but
+that seems inconsistent.
+
+The language does not define when the Pattern_Error check is made. (That's because
+many common searching implementations require a non-empty pattern) That means that
+the result for a call like Index ("", "") could be 0 or could raise Pattern_Error.
+Similarly, in the call Index ("", "", From => 2), the language does not define
+whether Pattern_Error or Index_Error is raised.
+
+!corrigendum A.4.3(56.2/2)
+
+@drepl
+Each Index function searches, starting from From, for a slice of Source, with
+length Pattern'Length, that matches Pattern with respect to Mapping; the parameter
+Going indicates the direction of the lookup. If From is not in Source'Range,
+then Index_Error is propagated. If Going = Forward, then Index returns the
+smallest index I which is greater than or equal to From such that the slice of
+Source starting at I matches Pattern. If Going = Backward, then Index returns
+the largest index I such that the slice of Source starting at I matches Pattern
+and has an upper bound less than or equal to From. If there is no such slice,
+then 0 is returned. If Pattern is the null string, then Pattern_Error is propagated.
+@dby
+Each Index function searches, starting from From, for a slice of Source, with
+length Pattern'Length, that matches Pattern with respect to Mapping; the parameter
+Going indicates the direction of the lookup. If Source is the null string, Index
+returns 0; otherwise, if From is not in Source'Range,
+then Index_Error is propagated. If Going = Forward, then Index returns the
+smallest index I which is greater than or equal to From such that the slice of
+Source starting at I matches Pattern. If Going = Backward, then Index returns
+the largest index I such that the slice of Source starting at I matches Pattern
+and has an upper bound less than or equal to From. If there is no such slice,
+then 0 is returned. If Pattern is the null string, then Pattern_Error is propagated.
 
 !ACATS Test
 

Questions? Ask the ACAA Technical Agent