comp.lang.ada
 help / color / mirror / Atom feed
From: Dmitry A. Kazakov <mailbox@dmitry-kazakov.de>
Subject: Re: Instanciation in a package spec.
Date: Thu, 23 Jan 2003 16:13:46 +0100
Date: 2003-01-23T16:13:46+01:00	[thread overview]
Message-ID: <8d103vca385t457d6p2e8uch8qe8p706g7@4ax.com> (raw)
In-Reply-To: wccn0lsvth6.fsf@shell01.TheWorld.com

On Thu, 23 Jan 2003 14:19:49 GMT, Robert A Duff
<bobduff@shell01.TheWorld.com> wrote:

>"Jean-Pierre Rosen" <rosen@adalog.fr> writes:
>
>> "Robert A Duff" <bobduff@shell01.TheWorld.com> a �crit dans le message de news: wccel752ki5.fsf@shell01.TheWorld.com...
>> > "Grein, Christoph" <christoph.grein@eurocopter.com> writes:
>> >
>> > > > * GNAT 3.15p issues:
>> > > >   pascalhe.ads:135:03: warning: cannot instantiate "Ad_hoc" before body seen
>> > > >   pascalhe.ads:135:03: warning: Program_Error will be raised at run time
>> > >
>> > > Believe Gnat. It's a RM rule to forbid instantiations before elaboration of the body.
>> >
>> > A very annoying rule, indeed.
>> >
>> ????
>> Since the body of the instance is elaborated at the point of instanciation, the body of the
>> generic has better been elaborated already....
>
>I understand the *need* for the rule in Ada.  But it's still an annoying
>restriction.  It's perfectly reasonable to want to export a generic and
>an instance of that generic from the same package.  But Ada's
>elaboration model prevents it.
>
>It's also annoying that you can't call a function in the same package:
>
>    package P is
>        function F(...) return T;
>        X: constant T;
>    private
>        X: constant T := F(...); -- raises P_E.
>    end P;
>
>The problem here is the elaboration model of Ada.  The *visibility* of
>things is too closely tied to the *elaboration* order.  I have worked
>out a different model of elaboration that doesn't have this problem (but
>still retains all the advantages of the Ada model).  Unfortunately, it's
>not Ada.

Why it cannot become Ada?

In other words, what is the price of your model?

Can  X become static (in your model), when F is pure?

---
Regards,
Dmitry Kazakov
www.dmitry-kazakov.de



  reply	other threads:[~2003-01-23 15:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-22 10:48 Instanciation in a package spec Grein, Christoph
2003-01-22 16:54 ` Robert A Duff
2003-01-23 10:54   ` Jean-Pierre Rosen
2003-01-23 14:19     ` Robert A Duff
2003-01-23 15:13       ` Dmitry A. Kazakov [this message]
2003-01-23 16:23         ` Robert A Duff
2003-01-25 11:04           ` Dmitry A. Kazakov
2003-01-23 15:13       ` Jean-Pierre Rosen
2003-01-23 16:14         ` Robert A Duff
  -- strict thread matches above, loose matches on Subject: below --
2003-01-22 10:22 Gautier direct_replies_not_read
2003-01-22 17:53 ` Martin Dowie
replies disabled

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