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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ca85d557480cf473,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-07-06 14:20:28 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!fu-berlin.de!uni-berlin.de!pcp01485549pcs.limstn01.de.comcast.NET!not-for-mail From: Ryan Tarpine Newsgroups: comp.lang.ada Subject: Hiding a type Date: Sat, 06 Jul 2002 17:17:51 +0000 Message-ID: <3D27263F.7070101@hotmail.com> NNTP-Posting-Host: pcp01485549pcs.limstn01.de.comcast.net (68.82.51.136) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: fu-berlin.de 1025990426 19106816 68.82.51.136 (16 [151722]) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020617 X-Accept-Language: en-us, en Xref: archiver1.google.com comp.lang.ada:26906 Date: 2002-07-06T17:17:51+00:00 List-Id: Hello everyone! I have just started learning Ada, and I am trying to use it on my next (personal) project. That's generally how I learn things, by jumping in too deep (It worked to teach myself OCaml, so we'll see how this turns out! :) What I'm wondering is how to hide a private type under a different, public name so variables can't be assigned. I'm not sure how to say it best, so here's the simplest example of it: package Test is type Hide is limited private; private subtype Hide is Integer; end Test; I want to write functions that will return something of type Hide in a way so clients can't do anything except pass it to other functions. I also don't want them to know if I change how I implement it. (In my real program, I'm trying to hide that Foo returns an access type.) Please tell how I should actually do this The exact errors I get are test.ads:2:10: missing full declaration for private type "Hide" test.ads:4:13: "Hide" conflicts with declaration at line 2 Thanks in advance, Ryan