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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d1df6bc3799debed X-Google-Attributes: gid103376,public From: Ben Brosgol Subject: Syntax for tagged record types (was Re: Not intended for use in medical,) Date: 1997/05/21 Message-ID: <33828299.2A3@world.std.com>#1/1 X-Deja-AN: 242755289 Sender: news@world.std.com (Mr Usenet Himself) References: <3.0.32.19970423164855.00746db8@mail.4dcomm.com> <5kl9qc$g4d@bcrkh13.bnr.ca> <5kmek2$9re@bcrkh13.bnr.ca> <33727FA5.5C7A@sprintmail.com> <3374C19F.15FE@sprintmail.com> <3376CF85.3E15@sprintmail.com> Organization: Aonix Reply-To: brosgol@world.std.com Newsgroups: comp.lang.ada Date: 1997-05-21T00:00:00+00:00 List-Id: Jon S Anthony wrote: > > As long as we are on about this sort of stuff, do you recall what the > reason was for using the "record" syntax with tagged types? Again, > not a big deal, but it seems kinda odd. Why not simply: > > type T is tagged > ... > end T; > > type C is new T with > ... > end C; > > type D is new T with null; > > Why the "record" syntax. Especially since tagged types are more > different from records than similar (extensible, dispatchable > primitive ops, maintain composability of user defined equal, ...) I don't recall that a proposal for the syntax type T is tagged ... end T; type T1 is new T with ... end T1; was ever discussed during the Ada 9X design. If the idea had come up, then the more likely syntax would have been type T is tagged ... end tagged; for consistency with record types. But then the derivation syntax would look odd: type T1 is new T with ... end tagged; -- Yecch The types whose declarations repeat the type identifier after the "end" are types that use the prefix notation, namely the task types and protected types: task type T1 is ... end T1; protected type T2 is ... end T2; As Robert Dewar mentioned in an earlier article, the subject of "prefix notation" for the OOP types, in particular Jean Ichbiah's proposal class type T is ... end T; did come up during the November 1992 WG9 meeting in Salem, Mass., but it was defeated. The requirement that underlay the OOP enhancements was "programming by extension", and Tucker and the design team looked at the Ada 83 type categories for which this concept made sense. Record types were an obvious candidate, and if you want a record type to be extended, then including the "record" reserved word in the type declaration seems fairly natural. (There was also at one point a proposal to allow extending enumeration types, but this was considered to be more a "nice to have" than an essential feature, and it did not make it into the language.) In any event, tagged types do share a number of properties with record types (such as component selection, aggregate notation, provision for discriminants), so using the "tagged record" syntax is not so strange. Ben Brosgol brosgol@aonix.com