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,ca85d557480cf473 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-07-06 14:31:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!kibo.news.demon.net!demon!diablo.netcom.net.uk!netcom.net.uk!news.tele.dk!small.news.tele.dk!207.115.63.138!newscon04.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!postmaster.news.prodigy.com!newssvr12.news.prodigy.com.POSTED!not-for-mail From: "Pat Rogers" Newsgroups: comp.lang.ada References: <3D27263F.7070101@hotmail.com> Subject: Re: Hiding a type X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: <7kJV8.2438$gy3.1099236449@newssvr12.news.prodigy.com> NNTP-Posting-Host: 208.191.182.164 X-Complaints-To: abuse@prodigy.net X-Trace: newssvr12.news.prodigy.com 1025991043 ST000 208.191.182.164 (Sat, 06 Jul 2002 17:30:43 EDT) NNTP-Posting-Date: Sat, 06 Jul 2002 17:30:43 EDT Organization: Prodigy Internet http://www.prodigy.com X-UserInfo1: [[PAPDCA[S@USVT^ORHL_IXBUSXHQD\MNPWZKB]MPXHNDQUBLNTC@AWZWDXZXQ[K\FFSKCVM@F_N_DOBWVWG__LG@VVOIPLIGX\\BU_B@\P\PFX\B[APHTWAHDCKJF^NHD[YJAZMCY_CWG[SX\Y]^KC\HSZRWSWKGAY_PC[BQ[BXAS\F\\@DMTLFZFUE@\VL Date: Sat, 06 Jul 2002 21:30:43 GMT Xref: archiver1.google.com comp.lang.ada:26907 Date: 2002-07-06T21:30:43+00:00 List-Id: "Ryan Tarpine" wrote in message news:3D27263F.7070101@hotmail.com... > 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! :) Do check out a textbook from the library -- it is worth the time -- or take one of the on-line tutorials. See www.adapower.com. > 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: > 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 package Opaque is type Hidden is limited private; -- declare the operations here that you want to export to clients private type Hidden is access all Integer; end Opaque; -- Patrick Rogers Consulting and Training in: http://www.classwide.com Real-Time/OO Languages progers@classwide.com Hard Deadline Schedulability Analysis (281)648-3165 Software Fault Tolerance