comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Ada-Singleton-Why does it work like this?
Date: Wed, 25 Mar 2009 08:16:47 -0700 (PDT)
Date: 2009-03-25T08:16:47-07:00	[thread overview]
Message-ID: <371e72ed-d20b-4fbc-b1de-aefde15e6caa@x1g2000prh.googlegroups.com> (raw)
In-Reply-To: 21fe3b9c-776d-47b6-8eaa-bb27ba53e83f@q16g2000yqg.googlegroups.com

On Mar 25, 7:40 am, Ludovic Brenta <ludo...@ludovic-brenta.org> wrote:
> On Mar 25, 3:10 pm, "patrick.gu...@googlemail.com"
>
>
>
> <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 := new T'(...);
> > > -- storage pool. Possible only in the package declaring T, since T is
> > > private.
>
> > > Other_Access_Value : Access_T := Access_Value; -- possible anywhere
>
> > > Neither Access_Value nor Other_Access_Value allow you to see the
> > > components of T because T is private.
>
> > I´m 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/Generics
> > 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´t use this construct together with the keyword generic, I
> > simply don´t get the meaning of (<>) in my Singleton-context. Do I say
> > that the type I declare is a discrete type? And what would I have to
> > do to use this type if it wasn´t 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



  reply	other threads:[~2009-03-25 15:16 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-24 19:01 Ada-Singleton-Why does it work like this? patrick.gunia
2009-03-24 19:10 ` Pascal Obry
2009-03-24 20:47 ` Jeffrey R. Carter
2009-03-25  0:10   ` Martin
2009-03-25  0:41     ` Jeffrey R. Carter
2009-03-25  9:30     ` Dmitry A. Kazakov
2009-03-26  8:55       ` Martin
2009-03-26  9:28         ` Dmitry A. Kazakov
2009-03-26 13:39           ` Maciej Sobczak
2009-03-26 14:07             ` Georg Bauhaus
2009-03-26 14:33               ` Dmitry A. Kazakov
2009-03-26 15:22                 ` Georg Bauhaus
2009-03-26 16:31                   ` Dmitry A. Kazakov
2009-03-26 14:28             ` Dmitry A. Kazakov
2009-03-26 22:00               ` Maciej Sobczak
2009-03-27 10:02                 ` Dmitry A. Kazakov
2009-03-25 22:29   ` sjw
2009-03-24 20:52 ` Ludovic Brenta
2009-03-25  9:59   ` patrick.gunia
2009-03-25 10:29     ` Jean-Pierre Rosen
2009-03-25 11:26     ` Georg Bauhaus
2009-03-25 11:49       ` patrick.gunia
2009-03-29  7:29     ` Jacob Sparre Andersen
2009-03-24 21:21 ` Dmitry A. Kazakov
2009-03-25 10:07   ` patrick.gunia
2009-03-25 10:57     ` patrick.gunia
2009-03-25 11:40       ` Georg Bauhaus
2009-03-25 11:46       ` Ludovic Brenta
2009-03-25 11:55         ` patrick.gunia
2009-03-25 14:10         ` patrick.gunia
2009-03-25 14:40           ` Ludovic Brenta
2009-03-25 15:16             ` Adam Beneschan [this message]
2009-03-25 15:19             ` patrick.gunia
2009-03-25 16:52               ` Georg Bauhaus
2009-03-25 11:10     ` Dmitry A. Kazakov
2009-03-25 11:37       ` patrick.gunia
2009-03-25 12:07         ` Ludovic Brenta
2009-03-25 15:00         ` Robert A Duff
2009-03-25 11:17     ` Jean-Pierre Rosen
2009-03-26  9:04       ` Martin
2009-03-25 11:38     ` Ludovic Brenta
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox