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.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,cbb87dd49168c396 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-01 16:35:21 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!newsfeed.mathworks.com!solaris.cc.vt.edu!news.vt.edu!msunews!not-for-mail From: "Chad R. Meiners" Newsgroups: comp.lang.ada Subject: Re: Get_Line Date: Fri, 1 Nov 2002 19:28:39 -0500 Organization: Michigan State University Message-ID: References: <3DBF3659.30709@acm.org> <4dRv9.46453$wm6.7691@nwrddc01.gnilink.net> <3DC0204E.4050203@acm.org> Reply-To: "Chad R. Meiners" NNTP-Posting-Host: arctic.cse.msu.edu X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2720.3000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Xref: archiver1.google.com comp.lang.ada:30299 Date: 2002-11-01T19:28:39-05:00 List-Id: "Matthew Heaney" wrote in message news:us63nof66esp1b@corp.supernews.com... > > "Chad R. Meiners" wrote in message > news:apuqd0$103i$1@msunews.cl.msu.edu... > > > > Would you be happy with the following instead? > > > > type Line is private; > > > > procedure Get_Line (File : File_Type; Item : out Line); > > > > You already have a resizable string type, so you'd be better off using that. > The easiest solution would be to create a child of Ada.Strings.Unbounded: The line type wasn't meant to be resizeable like Unbounded_String it was meant to only resize at an input read. > The closest thing in Ada is to use an access type: > > type Line_Type is private; > > type String_Access is access all String; > > function To_String_Access (Line : Line_Type) return String_Access; > > and then you could: > > declare > S : String renames To_String_Access (Line).all; --no copying > begin > > You could tighten the safety by being able to decorate the access type, e.g. > > type String_Access (<>) is limited access all String; > > which would prevent users from holding on to a copy of the access value > returned by the selector function (forcing them to do a rename, as above). Yes that would a better approach. I was just brainstorming. Thank you for your input. -CRM