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,25aa3c7e1b59f7b5 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-01-15 16:09:30 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-post-02!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "Matthew Heaney" Newsgroups: comp.lang.ada Subject: Re: A case where Ada defaults to unsafe? Date: Tue, 15 Jan 2002 19:14:03 -0500 Organization: Posted via Supernews, http://www.supernews.com Message-ID: References: <3C34BF2C.6030500@mail.com> <3C34D252.4070307@mail.com> <91J_7.1831$fG.7284@rwcrnsc51.ops.asp.att.net> X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 X-Complaints-To: newsabuse@supernews.com Xref: archiver1.google.com comp.lang.ada:18952 Date: 2002-01-15T19:14:03-05:00 List-Id: "Mark Lundquist" wrote in message news:91J_7.1831$fG.7284@rwcrnsc51.ops.asp.att.net... > 2) To have complete control over instances of an abstraction, we often > declare the type to be publicly limited and indefinite. But then if objects > of the type are to be created, they must be created on the heap and a > pointer returned to the client. That depends how you define "heap." Officially you allocate instances from a "storage pool," and the pool object may or may not be on the heap. I've written storage pools that were statically allocated, and so instances allocated via new come from static storage, not the heap. Actually, it's not even necessary to use an allocator, for example: package P is type T (<>) is limited private; type T_Access is access all T; function New_T return T_Access; end P; and then you can implement New_T by removing the head of a linked list of objects of type T. The point is that whatever decision you make is hidden behind function New_T.