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: mheaney@ni.net (Matthew Heaney) Subject: Re: Syntax for tagged record types (was Re: Not intended for use in medical,) Date: 1997/05/23 Message-ID: #1/1 X-Deja-AN: 243470837 Distribution: world 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> <33828299.2A3@world.std.com> Organization: Estormza Software Newsgroups: comp.lang.ada Date: 1997-05-23T00:00:00+00:00 List-Id: In article , jsa@alexandria (Jon S Anthony) wrote: >> Here is what I'd like to do: >> >> declare >> The_File : File_Type'Open (Name => "my_file.dat", Mode => In_Mode); >> begin >> >> Renaming a function return as a constant object won't fly, because I have >> to modify the object. > >Well then, it's not of a limited type, now is it? which is the context >that was being discussed... I'm confused by your comment. My intentation was that the example refer to Text_IO.File_Type, which very definately is limited; perhaps that wasn't clear. What I am proposing is a new syntax, by adding a constructor abstraction; File_Type'Open in this example. (Today, in Ada 95, Text_IO.Open is an ordinary procedure.) It would look something like: constructor Open (Name : String; Mode : File_Mode) return File_Type; or maybe constructor File_Type'Open (Name : String; Mode : File_Mode); We want to "invoke" the constructor during the elaboration of the File_Type object. We can do so as in the example above, using the tic notation, or just allow the assignment operator ":=" for constructor invokations. We would allow this for limited types too, like the limited type in the example above. Allowing the assignment operator for limited types isn't as heretical as it may seem. We already allow it in renaming declarations, by saying that it's not really assignment. For example: package P is type T is limited private; type AT is range 1 .. 3; function Op (O : T) return AT; ... end P; procedure Proc (O : T) is function Op (O : T := 0) return AT renames P.Op; begin X := Op; In that renames of function Op, the assignment symbol is used for limited type T. So maybe we don't need the tic notation after all. -------------------------------------------------------------------- Matthew Heaney Software Development Consultant (818) 985-1271