From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d534ed04fa87be8b,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-12-21 11:13:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!teaser.fr!enst.fr!not-for-mail From: Michal Nowak Newsgroups: comp.lang.ada Subject: Discriminant name must be alone Date: Sat, 21 Dec 2002 20:22:40 +0100 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: 7BIT X-Trace: avanie.enst.fr 1040497983 83205 137.194.161.2 (21 Dec 2002 19:13:03 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Sat, 21 Dec 2002 19:13:03 +0000 (UTC) Return-Path: X-Mailer: Calypso Version 3.30.00.00 (3) Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.13 Precedence: bulk X-Reply-To: vinnie@inetia.pl List-Unsubscribe: , List-Id: comp.lang.ada mail<->news gateway List-Post: List-Help: List-Subscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:32168 Date: 2002-12-21T20:22:40+01:00 Hello all, Digging around (teaching myself and experimenting with Ada) I wandered to RM 3.8 (12): "A name that denotes a noninherited discriminant is allowed within the declaration of the type, but not within the discriminant_part. If the discriminant is used to define the constraint of a component, the bounds of an entry family, or the constraint of the parent subtype in a derived_type_definition then its name shall appear alone as a direct_name (not as part of a larger expression or expanded name). A discriminant shall not be used to define the constraint of a scalar component." At this point (maybe later I will get deeper in other uses) I'm thinking about using a discriminant to define the constraint of a component. This rule forbids me to do something like this: type R (Start_Ind : Positive) is record Table : Some_Array_Type (1 .. Start_Ind + 10); end record; and like this: type R (Start_Ind : Positive) is record Table : Some_Array_Type (Start_Ind .. Start_Ind + 10); end record; I may live with this, but I don't like to blindly follow the rules, I'm a bit more curious :-). AARM (12a): "Reason: The penultimate restriction simplifies implementation, and allows the outer discriminant and the inner discriminant or bound to possibly share storage." gives me some explanation to this. In fact, in my first example, if the array was constrained by (1 .. Start_Ind), Start_Ind may be shared by record and array, but if it is (1 .. Start_Ind + 10) it cannot. In the second example Start_Ind may be shared, even if it breaks the rule two times, but that's only a specific example and does not shows my point. My questions: Why is this rule so restrictive? Is the (potential) possibility or simpler implementation only reason for it? Maybe there are historical (I may be too young to know them - I'm just freshly after studies) or so? If someone has any pointers I'll be glad to read them. >From the other side - if the possibility of shared storage is the only one, maybe it would be reasonable to weaken this rule in next Ada revision, to allow uses like above? So the memory usage depends on how discriminants are used. Are there any uses (examples), where it is reasonable to keep this rule in current form? Regards, - Michal -- ----------------------------------------------------------------- -- ___ _ -- / _ \ | | I Choose Ada: -- | |_| | ___| | _____ The Most Trusted Name in Software (TM) -- | _ | | __ | | __ | -- |_| |_| |_____|_ |_____|_ http://www.adaic.org/whyada/choose.html -- -- -----------------------------------------------------------------