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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,a3736685ef876ab2 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!j44g2000hsj.googlegroups.com!not-for-mail From: Matthew Heaney Newsgroups: comp.lang.ada Subject: Re: OO Style with Ada Containers Date: Mon, 26 Nov 2007 12:29:14 -0800 (PST) Organization: http://groups.google.com Message-ID: <50024075-f96e-4501-bca2-fef642b799a7@j44g2000hsj.googlegroups.com> References: <1195082906.420079.195000@d55g2000hsg.googlegroups.com> <1195084214.480299.13970@t8g2000prg.googlegroups.com> <1195084752.840598.174460@v65g2000hsc.googlegroups.com> <1195086265.070953.93180@d55g2000hsg.googlegroups.com> <2e37536e-55fb-42d5-a073-10b47cc31128@v4g2000hsf.googlegroups.com> NNTP-Posting-Host: 66.162.65.129 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1196108954 6995 127.0.0.1 (26 Nov 2007 20:29:14 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 26 Nov 2007 20:29:14 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: j44g2000hsj.googlegroups.com; posting-host=66.162.65.129; posting-account=umyUbgkAAADe5rQC4VzV-ffCoH4N30u3 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9,gzip(gfe),gzip(gfe) Content-Disposition: inline Xref: g2news1.google.com comp.lang.ada:18639 Date: 2007-11-26T12:29:14-08:00 List-Id: On Nov 26, 2:09 pm, braver wrote: > On Nov 26, 4:45 pm, Matthew Heaney > wrote: > > So in this case Handle goes away altogether? It was intended only to demonstrate another way to declare the type (at least, the public part). Implementation issues are orthogonal. You'd only need the Rosen Trick if you have a function that has side- effect (as function Word in my original example). Another possibility is: F : aliased File_Type; S : Scanner (F'Access); begin Another possibility is: procedure Get_Next (S : in out Scanner; Word : out Unbounded_String); Yet another possibility is: procedure Get_Next (S : in out Scanner; Word : out String; Last : out Natural); Or just: function Has_Word (S : Scanner) return Boolean; function Word (S : Scanner) return String; procedure Get_Next (S : in out Scanner); or: function Get_Next (S : Scanner) return Boolean; function Word (S : Scanner) return String; or how about this (perhaps simplest of all, since it hides explicit loops): generic with procedure Process (Word : String); procedure Generic_Scan (File : File_Type);