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,d1df6bc3799debed X-Google-Attributes: gid103376,public From: jsa@alexandria (Jon S Anthony) Subject: Re: Syntax for tagged record types (was Re: Not intended for use in medical,) Date: 1997/05/25 Message-ID: #1/1 X-Deja-AN: 243795343 Distribution: world References: <3.0.32.19970423164855.00746db8@mail.4dcomm.com> <33828299.2A3@world.std.com> <33850721.49BF@sprintmail.com> <33867D87.21BA@sprintmail.com> Organization: PSI Public Usenet Link Newsgroups: comp.lang.ada Date: 1997-05-25T00:00:00+00:00 List-Id: In article <33867D87.21BA@sprintmail.com> "John G. Volan" writes: > Just so folks won't be confused, what Jon's referring to here are > ordinary Ada functions that happen to return a value of a given type, Right. > > For limited types, the only way around this is to hide them behind > > access types for them. > > Right, when you deal with true object-oriented abstractions (as opposed > to value-oriented abstract data types), you inevitably have to invoke > reference semantics and the identity-vs-state issue. > > Here's a pattern I like to use for object-oriented types: > > type Some_Object_Type (<>) is tagged limited private; > type Some_Object_Access_Type is access all Some_Object_Type'Class; > > function Make_Some_Object (... from one set of parameters ...) > return Some_Object_Access_Type; <...> Exactly! Right on the mark. > (1) Some_Object_Type is limited, so assignment can't be used to casually Absolutely. > (3) Some_Object_Type has an unknown discriminant part, so a direct > declaration for an object of this type is illegal: > > Some_Object : Some_Object_Type; -- compiler error! indefinite type! Absolutely! > And the users can't get around this by trying to initialize the object > to something -- because it's a limited type, so assignment is illegal. Exactly! > > Then things again work just fine - except for > > storage management issues. Hence, the need for GC. Limited types are > > really extremely useful. Unfortunately, much of this is lost without > > GC support. > > Agreed. Well, with some luck this will not be so much an issue by some time this summer! :-) If I could only get out from under this proposal writing rubbish... /Jon -- Jon Anthony Organon Motives, Inc. Belmont, MA 02178 617.484.3383 jsa@organon.com