comp.lang.ada
 help / color / mirror / Atom feed
From: Hacid <chadi.alkurdi@gmail.com>
Subject: Re: limited /non-limited tagged type
Date: Fri, 4 Mar 2011 13:18:48 -0800 (PST)
Date: 2011-03-04T13:18:48-08:00	[thread overview]
Message-ID: <7fa882b5-72ab-4a76-9f4c-1c303cb04858@v31g2000vbs.googlegroups.com> (raw)
In-Reply-To: e11a9cdb-0c90-404b-a688-b1ee0a332a29@d12g2000prj.googlegroups.com

On 4 mar, 20:54, Edward Fish <edward.r.f...@gmail.com> wrote:
> On Mar 4, 11:56 am, Hacid <chadi.alku...@gmail.com> wrote:
>
>
>
> > Hi,
>
> > I haven't found an existing topic about this, so I ask my question :
>
> > I develop a package for colleagues. In this package I define a tagged
> > type. I want to prevent them from doing assignments on this type. But
> > I want to be able to do these assignments in my body.
>
> > I understand why I can't define my type limited in the public part and
> > not limited in the private part. But is there a way to do what I
> > want ?
>
> > Something like :
>
> > package Foo is
>
> >    type Object is tagged private;
>
> >    function ":=" (Left : out Object,; Right : in Object) is abstract;
> > -- I know this looks strange
>
> > end Foo;
>
> > Thanks.
>
> Yes, I think.
> You could add in an 'indirection step'.
>

--
package Whatever is

   type Public_Type is tagged limited private;

   --primitive functions.

private

  -- Base is the type that you will manipulate in the Body.
  type Base is tagged record
    -- fields
     null;
  end record;

  type Public_Type is new Base with null record;

end Whatever;
--
whatever.ads:15:08: completion of limited tagged type must be limited

This way seems to not work ... :o(



  reply	other threads:[~2011-03-04 21:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-04 18:56 limited /non-limited tagged type Hacid
2011-03-04 19:54 ` Edward Fish
2011-03-04 21:18   ` Hacid [this message]
2011-03-05  0:17     ` Edward Fish
2011-03-04 20:10 ` Georg Bauhaus
2011-03-04 21:55   ` Hacid
2011-03-04 22:21     ` Hacid
2011-03-05  1:20       ` Randy Brukardt
2011-03-04 22:22     ` Georg Bauhaus
2011-03-04 22:40       ` Hacid
2011-03-05  1:29         ` Georg Bauhaus
2011-03-04 23:34 ` Adam Beneschan
2011-03-05  3:26 ` Adam Beneschan
2011-03-05 16:48   ` Hacid
replies disabled

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