CVS difference for ai05s/ai05-0153-2.txt

Differences between 1.5 and version 1.6
Log of other versions for file ai05s/ai05-0153-2.txt

--- ai05s/ai05-0153-2.txt	2009/11/04 00:56:04	1.5
+++ ai05s/ai05-0153-2.txt	2009/11/04 06:26:38	1.6
@@ -1224,3 +1224,56 @@
 Not clear what you have in mind, at least to me, can you give an example?
 
 ****************************************************************
+
+From: Randy Brukardt
+Date: Tuesday, November 3, 2009  7:07 PM
+
+Since you guys are bound and determined to reinvent what Tucker, Steve, and I
+worked out last summer, I've posted the latest version of the AI in the cvs:
+http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ai05s/ai05-0153-2.txt
+
+To answer your question based on the AI proposal, here is the !example section
+of the AI:
+
+A simplified example:
+
+    type Entity_Kind is (Proc, Func, A_Type, A_Subtype, A_Package, An_Entry);
+
+    type Symbol_Record (Entity : Entity_Kind) is record ...
+
+    type Symbol_Ptr is access all Symbol_Record;
+
+    subtype Type_Symbol_Ptr is not null Symbol_Ptr (A_Type);
+    subtype Callable_Symbol_Ptr is
+       not null Symbol_Ptr (Entity_Kind when Proc | Func | An_Entry);
+
+    function Type_Size (A_Type : Type_Symbol_Ptr) return Size_Type;
+
+    procedure Generate_Call_Parameters (Callee : Callable_Symbol_Ptr; ...);
+
+
+Now, a call to Type_Size or Generate_Call_Parameters with a pointer to the wrong
+kind of symbol record will be detected at the call site rather than at some
+later point. The call site is closer to the source of the error; in addition, it
+is possible that the compiler can prove that the predicate will succeed and be
+able to remove the check altogether. That can't happen for a check inside of a
+subprogram.
+
+---
+
+In the above, note that "Callable_Symbol_Ptr" is a constrained access type,
+using a discriminant constraint that specifies a subtype rather than a single
+value. And the subtype is a discrete subtype_indication with a list_constraint.
+
+It should be noted that we couldn't find an very pleasing syntax for
+"list_constraints", because the obvious choices are very ambiguous
+(subtype_indications can appear in choice_lists, and a list_constraint includes
+a choice_list). My preferred syntax actually is:
+
+    Entity_Kind range [Proc | Func | An_Entry]
+
+but I only made that an alternative as it requires two new delimiters (the
+square brackets). I'm not sure if the resistance to new reserved words extends
+to new delimiters, and I didn't want that to derail this proposal.
+
+****************************************************************

Questions? Ask the ACAA Technical Agent