comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Building limited types through nested creator functions
Date: Tue, 07 Feb 2012 12:04:21 -0500
Date: 2012-02-07T12:04:21-05:00	[thread overview]
Message-ID: <wcc8vke7ey2.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 40048c5a-ecf5-43e6-8c76-a294d0c333d1@l14g2000vbe.googlegroups.com

Simon Belmont <sbelmont700@gmail.com> writes:

> Hi,
>
> Consider two limited record types, inner and outer, with the former
> nested inside the latter.  If the records are public, then code can
> initialize the outer by specifying an aggregate for the inner, as in:
>
> type Inner is limited
>   record
>     e : Integer;
>   end record;
>
> type Outer is limited
>   record
>     i : Inner;
>   end record;
>
> o : Outer := Outer'(i => Inner'(e => 42));
>
> However, if types are made private, suitable functions must be
> provided to make the appropriate objects.

I'm not sure exactly what you're trying to do, but maybe something
like this would work:

function Make_Outer(Make_Inner: not null access function return Inner) return Outer;

You can pass "parameters" to the actual for Make_Inner by
making it nested so it can see whatever it needs.

- Bob



      parent reply	other threads:[~2012-02-07 17:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-05 22:03 Building limited types through nested creator functions Simon Belmont
2012-02-06 12:44 ` Julian Leyh
2012-02-06 19:11 ` Shark8
2012-02-06 22:33   ` Simon Belmont
2012-02-07  0:03 ` Adam Beneschan
2012-02-07  0:27   ` Simon Belmont
2012-02-07  0:53     ` Adam Beneschan
2012-02-07  2:19       ` Simon Belmont
2012-02-07  9:10         ` Dmitry A. Kazakov
2012-02-07 10:58           ` Georg Bauhaus
2012-02-07 13:25             ` Dmitry A. Kazakov
2012-02-07 14:43               ` Yannick Duchêne (Hibou57)
2012-02-07 15:08                 ` Dmitry A. Kazakov
2012-02-07 17:04 ` Robert A Duff [this message]
replies disabled

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