comp.lang.ada
 help / color / mirror / Atom feed
From: Edward Fish <edward.r.fish@gmail.com>
Subject: Re: limited /non-limited tagged type
Date: Fri, 4 Mar 2011 11:54:05 -0800 (PST)
Date: 2011-03-04T11:54:05-08:00	[thread overview]
Message-ID: <e11a9cdb-0c90-404b-a688-b1ee0a332a29@d12g2000prj.googlegroups.com> (raw)
In-Reply-To: 40bfb845-7868-4536-886b-496e8dc82cb4@hd10g2000vbb.googlegroups.com

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 limited private tagged;
--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 Base with null record;

End Whatever;



  reply	other threads:[~2011-03-04 19:54 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 [this message]
2011-03-04 21:18   ` Hacid
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