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,af92cb4b0cc736af X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-31 12:58:31 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!nntp-server.caltech.edu!attla2!ip.att.net!attbi_feed3!attbi.com!sccrnsc03.POSTED!not-for-mail Message-ID: <3DC19973.1090001@attbi.com> From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: problem with abstract types References: <3DC12CFF.EC36842C@brighton.ac.uk> <3DC165F9.9000000@attbi.com> <3DC17454.6020407@acm.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 24.61.239.24 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc03 1036097908 24.61.239.24 (Thu, 31 Oct 2002 20:58:28 GMT) NNTP-Posting-Date: Thu, 31 Oct 2002 20:58:28 GMT Organization: AT&T Broadband Date: Thu, 31 Oct 2002 20:58:31 GMT Xref: archiver1.google.com comp.lang.ada:30269 Date: 2002-10-31T20:58:31+00:00 List-Id: Jeffrey Carter wrote: > I'm going to risk making a donkey of Fred Bloggs and his brother and > guess that he really meant to type > > Reg : Registry'Class := Open_Registry (...); Oops! Yep. > I have used Open_Registry because that's the Ada Way :) I was trying to not do too much of the Ada way and got burned! I would normally do this: package Registries is type Registry is limited private; type Access_Mode is (User_Mode, Supervisor_Mode); function Open_Registry(Name: String; Mode: Access_Mode := User_Mode) return Registry; private type Real_Registry(L: Natural) is tagged record Name: String(1..L); -- ... end record; type Registry is access Real_Registry'Class; end Registries; Actually, I'd probably go a bit further, and make Registry explicitly Controlled, to ensure that Registry objects were explicitly finalized. But that was definitely way out of bounds of this discussion.