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.2 required=5.0 tests=BAYES_00,FROM_WORDY, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2683e73445986fa2 X-Google-Attributes: gid103376,public From: "Nick Roberts" Subject: Re: Derivation + Access Discriminant = Headaches Date: 1999/03/20 Message-ID: <7cv0nu$dvk$4@plug.news.pipex.net>#1/1 X-Deja-AN: 456749720 References: X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Organization: UUNET WorldCom server (post doesn't reflect views of UUNET WorldCom) Newsgroups: comp.lang.ada Date: 1999-03-20T00:00:00+00:00 List-Id: RM95 3.7(15): 15 If a discriminant is used in the constraint defining the parent subtype, the subtype of the discriminant shall be statically compatible (see 4.9.1) with the subtype of the corresponding parent discriminant. AARM comments: 15.a Reason: This ensures that on conversion (or extension via an extension aggregate) to a distantly related type, if the discriminants satisfy the target type's requirements they satisfy all the intermediate types' requirements as well. 15.b Ramification: There is no requirement that the new discriminant have the same (or any) default_expression as the parent's discriminant. Thus it's no bug. However, I don't see why redefined access discriminants shouldn't be allowed to designate a type derived from (or within the class of) the type designated by the corresponding parental discriminant. An extra compiler check would be required: if an object of type T were to be converted to type NT (by an extension aggregate), its discriminant, O, would have to be checked for being in NT'Class (and Constraint_Error, presumably, raised if not). Conversions to 'distantly related types' would still only require one check, however, so the problem mentioned in AARM (15.a) is solved. Possibly this is something that could be changed at the next revision, if it's not considered an unnecessary complication (or there's some other reason why not that I'm missing). I guess Tuck or Bob will correct me if I'm on the wrong track here (again ;-). ------------------------------------- Nick Roberts -------------------------------------