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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e7eb1c5f294e17be X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-02-06 18:23:52 PST Newsgroups: comp.lang.ada Path: nntp.gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!rutgers!koriel!decwrl!pagesat.net!news.cerf.net!shrike.irvine.com!adam From: adam@irvine.com (Adam Beneschan) Subject: Re: Assignment of limited private types... References: <3gjce1$1he@theopolis.orl.mmc.com> Sender: usenet@irvine.com (News Administration) Organization: /z/news/newsctl/organization Date: Tue, 7 Feb 1995 02:23:52 GMT Message-ID: Date: 1995-02-07T02:23:52+00:00 List-Id: "Theodore E. Dennison" writes: >stevem@dcs.gla.ac.uk (Steve McGowan) wrote: > > > > I'd like to pass in a 'file_type' identifier into a task, make a local > > copy of this identifier within the task, and then write text to this > > file stream inside the task. > > > > But I cannot do this since 'file_type' is limited private. > > > > Any ideas how I can pass in this identifier, and to write to it > > locally? > > > > The reason people make types "limited private" is so users CAN'T > make local copies of the objects. If the designer wanted you to > be able to make copies of file_type objects, she would have made > the type "private". > > If for some reason you HAVE to make a copy, you could use an > unchecked_conversion, but DO NOT DO THIS! Odds are very high that > you will not get the results you desire. Try something else. I usually solve problems of this type by using pointers. E.g. type file_type_p is access file_type; Now, when you want to open and access a file: my_file := new file_type_p; text_io.open (my_file.all, ...); text_io.get_line (my_file.all, ...); etc. text_io.close (my_file.all); and you can assign file_type_p objects and pass them as parameters to your heart's content. Hope this helps, -- Adam