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,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d0490497bd8e3f95 X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Syntax for tagged record types Date: 1997/05/26 Message-ID: #1/1 X-Deja-AN: 244030436 References: Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 1997-05-26T00:00:00+00:00 List-Id: In article , Matthew Heaney wrote: >I say this because "discriminant" should mean "tag in a disjoint union." >Records are Cartesian product, and discriminated records are disjoint >union. And that's all discriminate record should mean. It wasn't that way in Ada 83: type T(Discrim_1: Natural; Discrim_2: Character; Discrim_3: Boolean) is record Comp: String(1..Discrim_1) := (others => Discrim_2); end record; I'm not sure whether you consider Discrim_1 as being a "tag in a disjoint union," but Discrim_2 certainly isn't -- it's being used to create an initial value. Discrim_3 isn't either -- it isn't used inside the record at all, and is merely a constant component of the record, initialized at the point of each object declaration. It seems to me that using discriminants inside an Initialize procedure is a reasonable generalization of the Ada 83 concept illustrated by Discrim_2. >It's not unlike another sin commited by many Ada programmers. That's when >you use "and then" in predicates, when you really mean "and." Many Ada >programmers do this in a naive attempt at some sort of optimization, but it >should only be used when you want to enforce an order dependence on >evaluation of the parts of the predicate. I agree with you about "and then". But I don't buy the analogy with discriminants. - Bob