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-Thread: 103376,b88383a5d9c51aa0 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!x1g2000prh.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Ada-Singleton-Why does it work like this? Date: Wed, 25 Mar 2009 08:16:47 -0700 (PDT) Organization: http://groups.google.com Message-ID: <371e72ed-d20b-4fbc-b1de-aefde15e6caa@x1g2000prh.googlegroups.com> References: <5a7a870c-40e2-4803-8753-0f9cfd2b800f@k2g2000yql.googlegroups.com> <13su65cm8b5ov$.1198qla32cc3i$.dlg@40tude.net> <0c060dc1-ee16-48cd-89cf-5f4f02185ee8@c11g2000yqj.googlegroups.com> <21fe3b9c-776d-47b6-8eaa-bb27ba53e83f@q16g2000yqg.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1237994207 10530 127.0.0.1 (25 Mar 2009 15:16:47 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 25 Mar 2009 15:16:47 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: x1g2000prh.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:5273 Date: 2009-03-25T08:16:47-07:00 List-Id: On Mar 25, 7:40 am, Ludovic Brenta wrote: > On Mar 25, 3:10 pm, "patrick.gu...@googlemail.com" > > > > wrote: > > > If you want to declare an access type, you do not need an instance; > > > you only need a type, which may be unconstrained: > > > > type T (<>) is limited private; > > > type Access_T is access T; -- OK > > > > If you want an access *value*, then you do need an object; either one > > > from a storage pool, or a pre-existing one: > > > > Access_Value : Access_T :=3D new T'(...); > > > -- storage pool. Possible only in the package declaring T, since T is > > > private. > > > > Other_Access_Value : Access_T :=3D Access_Value; -- possible anywhere > > > > Neither Access_Value nor Other_Access_Value allow you to see the > > > components of T because T is private. > > > I=B4m currently trying to formulate some rules for using Ada myself, > > trying to explain the concepts which are used. I got one last question > > concerning the box-operator (<>) in this particular context. > > It declares a type to be unconstrained, which means, that it needs to > > be initialized. I only found this construction together with generic > > types, for example here:http://en.wikibooks.org/wiki/Ada_Programming/Ge= nerics > > When I try to define a sort-routine I can use this generic form to > > state, that discrete types may be used as input for such a routine. > > But as I don=B4t use this construct together with the keyword generic, = I > > simply don=B4t get the meaning of (<>) in my Singleton-context. Do I sa= y > > that the type I declare is a discrete type? And what would I have to > > do to use this type if it wasn=B4t limited and private? > > > Thank you! > > Please re-read the wikibook chapter on generics; there is a difference > between: > > generic > type T1 is <>; -- any discrete type should be generic type T1 is (<>); -- Adam